Remove style differences between project and buffer search

Lukas Wirth created

Change summary

crates/search/src/buffer_search.rs  | 29 ++++++++++++++++-------------
crates/search/src/project_search.rs |  8 +++++---
2 files changed, 21 insertions(+), 16 deletions(-)

Detailed changes

crates/search/src/buffer_search.rs 🔗

@@ -290,7 +290,7 @@ impl Render for BufferSearchBar {
                 let query_focus = self.query_editor.focus_handle(cx);
                 let matches_column = h_flex()
                     .pl_2()
-                    .ml_1()
+                    .ml_2()
                     .border_l_1()
                     .border_color(theme_colors.border_variant)
                     .child(render_action_button(
@@ -308,7 +308,18 @@ impl Render for BufferSearchBar {
                         "Select Next Match",
                         &SelectNextMatch,
                         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(
                     "buffer-search-nav-button",
@@ -319,17 +330,6 @@ impl Render for BufferSearchBar {
                     query_focus,
                 ))
                 .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| {
                 el.child(render_action_button(
@@ -343,6 +343,7 @@ impl Render for BufferSearchBar {
             });
 
         let search_line = h_flex()
+            .w_full()
             .gap_2()
             .when(find_in_results, |el| {
                 el.child(Label::new("Find in results").color(Color::Hint))
@@ -376,6 +377,7 @@ impl Render for BufferSearchBar {
                         focus_handle,
                     ));
                 h_flex()
+                    .w_full()
                     .gap_2()
                     .child(replace_column)
                     .child(replace_actions)
@@ -414,6 +416,7 @@ impl Render for BufferSearchBar {
             .id("buffer_search")
             .gap_2()
             .py(px(1.0))
+            .w_full()
             .track_scroll(&self.scroll_handle)
             .key_context(key_context)
             .capture_action(cx.listener(Self::tab))

crates/search/src/project_search.rs 🔗

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