Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
search: Fix project search not rendering matches count (#36238)
Lukas Wirth846ed6adf91f
diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rsindex 6b9777906af..b791f748adf 100644--- a/crates/search/src/project_search.rs+++ b/crates/search/src/project_search.rs@@ -1975,6 +1975,48 @@ impl Render for ProjectSearchBar {),);+ let query_focus = search.query_editor.focus_handle(cx);++ let matches_column = h_flex()+ .pl_2()+ .ml_2()+ .border_l_1()+ .border_color(theme_colors.border_variant)+ .child(render_action_button(+ "project-search-nav-button",+ IconName::ChevronLeft,+ search.active_match_index.is_some(),+ "Select Previous Match",+ &SelectPreviousMatch,+ query_focus.clone(),+ ))+ .child(render_action_button(+ "project-search-nav-button",+ IconName::ChevronRight,+ search.active_match_index.is_some(),+ "Select Next Match",+ &SelectNextMatch,+ query_focus,+ ))+ .child(+ div()+ .id("matches")+ .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+ } else {+ Color::Disabled+ },+ ))+ .when(limit_reached, |el| {+ el.tooltip(Tooltip::text(+ "Search limits reached.\nTry narrowing your search.",+ ))+ }),+ );+let mode_column = h_flex().gap_1().min_w_64()@@ -2016,55 +2058,14 @@ impl Render for ProjectSearchBar {"Toggle Replace",&ToggleReplace,focus_handle.clone(),- ));-- let query_focus = search.query_editor.focus_handle(cx);-- let matches_column = h_flex()- .pl_2()- .ml_2()- .border_l_1()- .border_color(theme_colors.border_variant)- .child(render_action_button(- "project-search-nav-button",- IconName::ChevronLeft,- search.active_match_index.is_some(),- "Select Previous Match",- &SelectPreviousMatch,- query_focus.clone(),))- .child(render_action_button(- "project-search-nav-button",- IconName::ChevronRight,- search.active_match_index.is_some(),- "Select Next Match",- &SelectNextMatch,- query_focus,- ))- .child(- div()- .id("matches")- .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- } else {- Color::Disabled- },- ))- .when(limit_reached, |el| {- el.tooltip(Tooltip::text(- "Search limits reached.\nTry narrowing your search.",- ))- }),- );+ .child(matches_column);let search_line = h_flex().w_full().gap_2().child(query_column)- .child(h_flex().min_w_64().child(mode_column).child(matches_column));+ .child(mode_column);let replace_line = search.replace_enabled.then(|| {let replace_column = input_base_styles(InputPanel::Replacement)