mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-28 19:25:33 +03:00
Focus the project find results editor on a tab in the query editor
This commit is contained in:
parent
71241b1fb8
commit
1ddae2adfd
@ -45,8 +45,9 @@ pub fn init(cx: &mut MutableAppContext) {
|
||||
cx.add_action(ProjectSearchView::search);
|
||||
cx.add_action(ProjectSearchView::search_in_new);
|
||||
cx.add_action(ProjectSearchView::toggle_search_option);
|
||||
cx.add_action(ProjectSearchView::toggle_focus);
|
||||
cx.add_action(ProjectSearchView::select_match);
|
||||
cx.add_action(ProjectSearchView::toggle_focus);
|
||||
cx.capture_action(ProjectSearchView::tab);
|
||||
}
|
||||
|
||||
struct ProjectSearch {
|
||||
@ -521,6 +522,16 @@ impl ProjectSearchView {
|
||||
}
|
||||
}
|
||||
|
||||
fn tab(&mut self, _: &editor::Tab, cx: &mut ViewContext<Self>) {
|
||||
if self.query_editor.is_focused(cx) {
|
||||
if !self.model.read(cx).match_ranges.is_empty() {
|
||||
self.focus_results_editor(cx);
|
||||
}
|
||||
} else {
|
||||
cx.propagate_action()
|
||||
}
|
||||
}
|
||||
|
||||
fn focus_results_editor(&self, cx: &mut ViewContext<Self>) {
|
||||
self.query_editor.update(cx, |query_editor, cx| {
|
||||
let cursor = query_editor.newest_anchor_selection().head();
|
||||
|
Loading…
Reference in New Issue
Block a user