Address picker issues

This commit is contained in:
K Simmons 2022-08-09 15:51:17 -07:00
parent 6f180ed822
commit f5a6a112c8
9 changed files with 24 additions and 9 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -81,8 +81,10 @@ impl View for BufferSearchBar {
} }
fn on_focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext<Self>) { fn on_focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext<Self>) {
if cx.is_self_focused() {
cx.focus(&self.query_editor); cx.focus(&self.query_editor);
} }
}
fn render(&mut self, cx: &mut RenderContext<Self>) -> ElementBox { fn render(&mut self, cx: &mut RenderContext<Self>) -> ElementBox {
let theme = cx.global::<Settings>().theme.clone(); let theme = cx.global::<Settings>().theme.clone();

View file

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

View file

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

View file

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