Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Add Editor::Tab and CycleMode actions
Piotr Osiewicz40c1ef88e22f
diff --git a/crates/search2/src/project_search.rs b/crates/search2/src/project_search.rsindex d006e26a9a1..3768f00b423 100644--- a/crates/search2/src/project_search.rs+++ b/crates/search2/src/project_search.rs@@ -1287,18 +1287,15 @@ impl ProjectSearchBar {subscription: Default::default(),}}- fn cycle_mode(workspace: &mut Workspace, _: &CycleMode, cx: &mut ViewContext<Workspace>) {- if let Some(search_view) = workspace- .active_item(cx)- .and_then(|item| item.downcast::<ProjectSearchView>())- {- search_view.update(cx, |this, cx| {- let new_mode =- crate::mode::next_mode(&this.current_mode, SemanticIndex::enabled(cx));+ fn cycle_mode(&self, _: &CycleMode, cx: &mut ViewContext<Self>) {+ if let Some(view) = self.active_project_search.as_ref() {+ view.update(cx, |this, cx| {+ // todo: po: 2nd argument of `next_mode` should be `SemanticIndex::enabled(cx))`, but we need to flesh out port of semantic_index first.+ let new_mode = crate::mode::next_mode(&this.current_mode, false);this.activate_search_mode(new_mode, cx);let editor_handle = this.query_editor.focus_handle(cx);cx.focus(&editor_handle);- })+ });}}fn confirm(&mut self, _: &Confirm, cx: &mut ViewContext<Self>) {@@ -1800,6 +1797,15 @@ impl Render for ProjectSearchBar {})}}))+ .on_action(cx.listener(|this, action, cx| {+ this.tab(action, cx);+ }))+ .on_action(cx.listener(|this, action, cx| {+ this.tab_previous(action, cx);+ }))+ .on_action(cx.listener(|this, action, cx| {+ this.cycle_mode(action, cx);+ })).child(query_column).child(mode_column).child(replace_column)