From bc9086c9aff3f3cf5ca6f32eb9d52ea6def8319d Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Tue, 22 Oct 2024 16:11:59 +0200 Subject: [PATCH] ssh: Fix file picker not getting focus when it's opened for the first time (#19546) Release Notes: - N/A Co-authored-by: Danilo --- crates/recent_projects/src/remote_servers.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/crates/recent_projects/src/remote_servers.rs b/crates/recent_projects/src/remote_servers.rs index d2548dca9312beb4a4cd0f022a12a3f7688e76e7..e47ecda32a01fec8e0045a7c437971d51193d281 100644 --- a/crates/recent_projects/src/remote_servers.rs +++ b/crates/recent_projects/src/remote_servers.rs @@ -182,6 +182,12 @@ impl SelectableItemList { } } +impl FocusableView for ProjectPicker { + fn focus_handle(&self, cx: &AppContext) -> FocusHandle { + self.picker.focus_handle(cx) + } +} + impl ProjectPicker { fn new( ix: usize, @@ -379,6 +385,7 @@ impl RemoteServerProjects { workspace, cx, )); + cx.notify(); this } @@ -1226,8 +1233,11 @@ fn get_text(element: &View, cx: &mut WindowContext) -> String { impl ModalView for RemoteServerProjects {} impl FocusableView for RemoteServerProjects { - fn focus_handle(&self, _cx: &AppContext) -> FocusHandle { - self.focus_handle.clone() + fn focus_handle(&self, cx: &AppContext) -> FocusHandle { + match &self.mode { + Mode::ProjectPicker(picker) => picker.focus_handle(cx), + _ => self.focus_handle.clone(), + } } }