Remove style differences between project and buffer search

This commit is contained in:
Lukas Wirth 2025-08-13 12:00:27 +02:00
parent 3cda09f875
commit 9b6b7f1412
2 changed files with 21 additions and 16 deletions

View file

@ -290,7 +290,7 @@ impl Render for BufferSearchBar {
let query_focus = self.query_editor.focus_handle(cx); let query_focus = self.query_editor.focus_handle(cx);
let matches_column = h_flex() let matches_column = h_flex()
.pl_2() .pl_2()
.ml_1() .ml_2()
.border_l_1() .border_l_1()
.border_color(theme_colors.border_variant) .border_color(theme_colors.border_variant)
.child(render_action_button( .child(render_action_button(
@ -308,7 +308,18 @@ impl Render for BufferSearchBar {
"Select Next Match", "Select Next Match",
&SelectNextMatch, &SelectNextMatch,
query_focus.clone(), query_focus.clone(),
)); ))
.when(!narrow_mode, |this| {
this.child(div().ml_2().min_w(rems_from_px(40.)).child(
Label::new(match_text).size(LabelSize::Small).color(
if self.active_match_index.is_some() {
Color::Default
} else {
Color::Disabled
},
),
))
});
el.child(render_action_button( el.child(render_action_button(
"buffer-search-nav-button", "buffer-search-nav-button",
@ -319,17 +330,6 @@ impl Render for BufferSearchBar {
query_focus, query_focus,
)) ))
.child(matches_column) .child(matches_column)
.when(!narrow_mode, |this| {
this.child(h_flex().ml_2().min_w(rems_from_px(40.)).child(
Label::new(match_text).size(LabelSize::Small).color(
if self.active_match_index.is_some() {
Color::Default
} else {
Color::Disabled
},
),
))
})
}) })
.when(find_in_results, |el| { .when(find_in_results, |el| {
el.child(render_action_button( el.child(render_action_button(
@ -343,6 +343,7 @@ impl Render for BufferSearchBar {
}); });
let search_line = h_flex() let search_line = h_flex()
.w_full()
.gap_2() .gap_2()
.when(find_in_results, |el| { .when(find_in_results, |el| {
el.child(Label::new("Find in results").color(Color::Hint)) el.child(Label::new("Find in results").color(Color::Hint))
@ -376,6 +377,7 @@ impl Render for BufferSearchBar {
focus_handle, focus_handle,
)); ));
h_flex() h_flex()
.w_full()
.gap_2() .gap_2()
.child(replace_column) .child(replace_column)
.child(replace_actions) .child(replace_actions)
@ -414,6 +416,7 @@ impl Render for BufferSearchBar {
.id("buffer_search") .id("buffer_search")
.gap_2() .gap_2()
.py(px(1.0)) .py(px(1.0))
.w_full()
.track_scroll(&self.scroll_handle) .track_scroll(&self.scroll_handle)
.key_context(key_context) .key_context(key_context)
.capture_action(cx.listener(Self::tab)) .capture_action(cx.listener(Self::tab))

View file

@ -2009,6 +2009,7 @@ impl Render for ProjectSearchBar {
let mode_column = h_flex() let mode_column = h_flex()
.gap_1() .gap_1()
.min_w_64()
.child( .child(
IconButton::new("project-search-filter-button", IconName::Filter) IconButton::new("project-search-filter-button", IconName::Filter)
.shape(IconButtonShape::Square) .shape(IconButtonShape::Square)
@ -2075,7 +2076,8 @@ impl Render for ProjectSearchBar {
.child( .child(
div() div()
.id("matches") .id("matches")
.ml_1() .ml_2()
.min_w(rems_from_px(40.))
.child(Label::new(match_text).size(LabelSize::Small).color( .child(Label::new(match_text).size(LabelSize::Small).color(
if search.active_match_index.is_some() { if search.active_match_index.is_some() {
Color::Default Color::Default
@ -2201,7 +2203,9 @@ impl Render for ProjectSearchBar {
}); });
v_flex() v_flex()
.gap_2()
.py(px(1.0)) .py(px(1.0))
.w_full()
.key_context(key_context) .key_context(key_context)
.on_action(cx.listener(|this, _: &ToggleFocus, window, cx| { .on_action(cx.listener(|this, _: &ToggleFocus, window, cx| {
this.move_focus_to_results(window, cx) this.move_focus_to_results(window, cx)
@ -2248,8 +2252,6 @@ impl Render for ProjectSearchBar {
}) })
.on_action(cx.listener(Self::select_next_match)) .on_action(cx.listener(Self::select_next_match))
.on_action(cx.listener(Self::select_prev_match)) .on_action(cx.listener(Self::select_prev_match))
.gap_2()
.w_full()
.child(search_line) .child(search_line)
.children(query_error_line) .children(query_error_line)
.children(replace_line) .children(replace_line)