From a78fe4ef6a19d502ca24acf90028f4f22c0dea48 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Sat, 26 Feb 2022 14:43:02 +0100 Subject: [PATCH] Don't focus results editor on `cmd-shift-f` when there are no results --- crates/find/src/project_find.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/find/src/project_find.rs b/crates/find/src/project_find.rs index c97e37168c..5a1214561e 100644 --- a/crates/find/src/project_find.rs +++ b/crates/find/src/project_find.rs @@ -22,7 +22,6 @@ action!(ToggleFocus); pub fn init(cx: &mut MutableAppContext) { cx.add_bindings([ - Binding::new("cmd-shift-F", ToggleFocus, Some("ProjectFindView")), Binding::new("cmd-shift-F", ToggleFocus, Some("ProjectFindView")), Binding::new("cmd-f", ToggleFocus, Some("ProjectFindView")), Binding::new("cmd-shift-F", Deploy(true), Some("Workspace")), @@ -385,7 +384,9 @@ impl ProjectFindView { fn toggle_focus(&mut self, _: &ToggleFocus, cx: &mut ViewContext) { if self.query_editor.is_focused(cx) { - cx.focus(&self.results_editor); + if !self.model.read(cx).highlighted_ranges.is_empty() { + cx.focus(&self.results_editor); + } } else { cx.focus(&self.query_editor); }