Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
project search: Move to results with ESC
Piotr Osiewicz7314838fa469
diff --git a/crates/search2/src/project_search.rs b/crates/search2/src/project_search.rsindex ab94466cf71..8c673edbe4e 100644--- a/crates/search2/src/project_search.rs+++ b/crates/search2/src/project_search.rs@@ -1224,6 +1224,14 @@ impl ProjectSearchView {cx.theme().colors().border}}+ fn move_focus_to_results(&mut self, cx: &mut ViewContext<Self>) {+ if !self.results_editor.focus_handle(cx).is_focused(cx)+ && !self.model.read(cx).match_ranges.is_empty()+ {+ cx.stop_propagation();+ return self.focus_results_editor(cx);+ }+ }}impl Default for ProjectSearchBar {@@ -1398,6 +1406,15 @@ impl ProjectSearchBar {}}+ fn move_focus_to_results(&self, cx: &mut ViewContext<Self>) {+ if let Some(search_view) = self.active_project_search.as_ref() {+ search_view.update(cx, |search_view, cx| {+ search_view.move_focus_to_results(cx);+ });+ cx.notify();+ }+ }+fn activate_search_mode(&self, mode: SearchMode, cx: &mut ViewContext<Self>) {// Update Current Modeif let Some(search_view) = self.active_project_search.as_ref() {@@ -1754,6 +1771,7 @@ impl Render for ProjectSearchBar {.key_context(key_context).flex_grow().gap_2()+ .on_action(cx.listener(|this, _: &ToggleFocus, cx| this.move_focus_to_results(cx))).on_action(cx.listener(|this, _: &ToggleFilters, cx| {this.toggle_filters(cx);}))