Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Focus active item when pressing tab in buffer search bar
Antonio Scandurra209fe7e0faf0
diff --git a/crates/search2/src/buffer_search.rs b/crates/search2/src/buffer_search.rsindex 96b40aa2bfc..be01266eef3 100644--- a/crates/search2/src/buffer_search.rs+++ b/crates/search2/src/buffer_search.rs@@ -7,7 +7,7 @@ use crate::{ToggleCaseSensitive, ToggleReplace, ToggleWholeWord,};use collections::HashMap;-use editor::{Editor, EditorElement, EditorStyle};+use editor::{Editor, EditorElement, EditorStyle, Tab};use futures::channel::oneshot;use gpui::{actions, div, impl_actions, Action, AppContext, ClickEvent, EventEmitter, FocusableView,@@ -190,6 +190,7 @@ impl Render for BufferSearchBar {.w_full().gap_2().key_context(key_context)+ .capture_action(cx.listener(Self::tab)).on_action(cx.listener(Self::previous_history_query)).on_action(cx.listener(Self::next_history_query)).on_action(cx.listener(Self::dismiss))@@ -932,6 +933,14 @@ impl BufferSearchBar {}}+ fn tab(&mut self, _: &Tab, cx: &mut ViewContext<Self>) {+ if let Some(item) = self.active_searchable_item.as_ref() {+ let focus_handle = item.focus_handle(cx);+ cx.focus(&focus_handle);+ cx.stop_propagation();+ }+ }+fn next_history_query(&mut self, _: &NextHistoryQuery, cx: &mut ViewContext<Self>) {if let Some(new_query) = self.search_history.next().map(str::to_string) {let _ = self.search(&new_query, Some(self.search_options), cx);