@@ -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);