diff --git a/crates/command_palette/src/command_palette.rs b/crates/command_palette/src/command_palette.rs index 5d6f6e14a8..6bef826e5b 100644 --- a/crates/command_palette/src/command_palette.rs +++ b/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) { - cx.focus(&self.picker); + if cx.is_self_focused() { + cx.focus(&self.picker); + } } } diff --git a/crates/file_finder/src/file_finder.rs b/crates/file_finder/src/file_finder.rs index aeec799015..dbdc3ec329 100644 --- a/crates/file_finder/src/file_finder.rs +++ b/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) { - cx.focus(&self.picker); + if cx.is_self_focused() { + cx.focus(&self.picker); + } } } diff --git a/crates/outline/src/outline.rs b/crates/outline/src/outline.rs index 8a8c559cf3..414a48ed10 100644 --- a/crates/outline/src/outline.rs +++ b/crates/outline/src/outline.rs @@ -53,7 +53,9 @@ impl View for OutlineView { } fn on_focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext) { - cx.focus(&self.picker); + if cx.is_self_focused() { + cx.focus(&self.picker); + } } } diff --git a/crates/picker/src/picker.rs b/crates/picker/src/picker.rs index d3f729ba83..19a01fcbad 100644 --- a/crates/picker/src/picker.rs +++ b/crates/picker/src/picker.rs @@ -119,7 +119,9 @@ impl View for Picker { } fn on_focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext) { - cx.focus(&self.query_editor); + if cx.is_self_focused() { + cx.focus(&self.query_editor); + } } } diff --git a/crates/project_symbols/src/project_symbols.rs b/crates/project_symbols/src/project_symbols.rs index 755bca20d6..c310cfb043 100644 --- a/crates/project_symbols/src/project_symbols.rs +++ b/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) { - cx.focus(&self.picker); + if cx.is_self_focused() { + cx.focus(&self.picker); + } } } diff --git a/crates/search/src/buffer_search.rs b/crates/search/src/buffer_search.rs index d9a048b604..bc6f37202d 100644 --- a/crates/search/src/buffer_search.rs +++ b/crates/search/src/buffer_search.rs @@ -81,7 +81,9 @@ impl View for BufferSearchBar { } fn on_focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext) { - cx.focus(&self.query_editor); + if cx.is_self_focused() { + cx.focus(&self.query_editor); + } } fn render(&mut self, cx: &mut RenderContext) -> ElementBox { diff --git a/crates/terminal/src/terminal_view.rs b/crates/terminal/src/terminal_view.rs index a3492c2a94..1b4544a3dc 100644 --- a/crates/terminal/src/terminal_view.rs +++ b/crates/terminal/src/terminal_view.rs @@ -153,7 +153,9 @@ impl View for TerminalView { } fn on_focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext) { - cx.focus(self.content.handle()); + if cx.is_self_focused() { + cx.focus(self.content.handle()); + } } fn keymap_context(&self, _: &gpui::AppContext) -> gpui::keymap::Context { diff --git a/crates/theme_selector/src/theme_selector.rs b/crates/theme_selector/src/theme_selector.rs index d1e81b11a7..dcda882168 100644 --- a/crates/theme_selector/src/theme_selector.rs +++ b/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) { - cx.focus(&self.picker); + if cx.is_self_focused() { + cx.focus(&self.picker); + } } } diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index c4b625c725..7043c3a683 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -2476,7 +2476,6 @@ impl View for Workspace { fn on_focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext) { if cx.is_self_focused() { - println!("Active Pane Focused"); cx.focus(&self.active_pane); } }