Address picker issues

K Simmons created

Change summary

crates/command_palette/src/command_palette.rs | 4 +++-
crates/file_finder/src/file_finder.rs         | 4 +++-
crates/outline/src/outline.rs                 | 4 +++-
crates/picker/src/picker.rs                   | 4 +++-
crates/project_symbols/src/project_symbols.rs | 4 +++-
crates/search/src/buffer_search.rs            | 4 +++-
crates/terminal/src/terminal_view.rs          | 4 +++-
crates/theme_selector/src/theme_selector.rs   | 4 +++-
crates/workspace/src/workspace.rs             | 1 -
9 files changed, 24 insertions(+), 9 deletions(-)

Detailed changes

crates/command_palette/src/command_palette.rs 🔗

@@ -134,7 +134,9 @@ impl View for CommandPalette {
     }
 
     fn on_focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext<Self>) {
-        cx.focus(&self.picker);
+        if cx.is_self_focused() {
+            cx.focus(&self.picker);
+        }
     }
 }
 

crates/file_finder/src/file_finder.rs 🔗

@@ -54,7 +54,9 @@ impl View for FileFinder {
     }
 
     fn on_focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext<Self>) {
-        cx.focus(&self.picker);
+        if cx.is_self_focused() {
+            cx.focus(&self.picker);
+        }
     }
 }
 

crates/outline/src/outline.rs 🔗

@@ -53,7 +53,9 @@ impl View for OutlineView {
     }
 
     fn on_focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext<Self>) {
-        cx.focus(&self.picker);
+        if cx.is_self_focused() {
+            cx.focus(&self.picker);
+        }
     }
 }
 

crates/picker/src/picker.rs 🔗

@@ -119,7 +119,9 @@ impl<D: PickerDelegate> View for Picker<D> {
     }
 
     fn on_focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext<Self>) {
-        cx.focus(&self.query_editor);
+        if cx.is_self_focused() {
+            cx.focus(&self.query_editor);
+        }
     }
 }
 

crates/project_symbols/src/project_symbols.rs 🔗

@@ -52,7 +52,9 @@ impl View for ProjectSymbolsView {
     }
 
     fn on_focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext<Self>) {
-        cx.focus(&self.picker);
+        if cx.is_self_focused() {
+            cx.focus(&self.picker);
+        }
     }
 }
 

crates/search/src/buffer_search.rs 🔗

@@ -81,7 +81,9 @@ impl View for BufferSearchBar {
     }
 
     fn on_focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext<Self>) {
-        cx.focus(&self.query_editor);
+        if cx.is_self_focused() {
+            cx.focus(&self.query_editor);
+        }
     }
 
     fn render(&mut self, cx: &mut RenderContext<Self>) -> ElementBox {

crates/terminal/src/terminal_view.rs 🔗

@@ -153,7 +153,9 @@ impl View for TerminalView {
     }
 
     fn on_focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext<Self>) {
-        cx.focus(self.content.handle());
+        if cx.is_self_focused() {
+            cx.focus(self.content.handle());
+        }
     }
 
     fn keymap_context(&self, _: &gpui::AppContext) -> gpui::keymap::Context {

crates/theme_selector/src/theme_selector.rs 🔗

@@ -250,6 +250,8 @@ impl View for ThemeSelector {
     }
 
     fn on_focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext<Self>) {
-        cx.focus(&self.picker);
+        if cx.is_self_focused() {
+            cx.focus(&self.picker);
+        }
     }
 }

crates/workspace/src/workspace.rs 🔗

@@ -2476,7 +2476,6 @@ impl View for Workspace {
 
     fn on_focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext<Self>) {
         if cx.is_self_focused() {
-            println!("Active Pane Focused");
             cx.focus(&self.active_pane);
         }
     }