From 0d7f3ef278e0f5483e5741488f97418ade147b50 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sat, 6 Jan 2024 11:39:27 +0200 Subject: [PATCH] Fix base keymap selector keyboard shortcuts --- crates/welcome/src/base_keymap_picker.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/crates/welcome/src/base_keymap_picker.rs b/crates/welcome/src/base_keymap_picker.rs index 9a8edf0eb33b21b4d324c8390e638febe777e643..b798325473be65091a1c17a4cd6d4b1e435c015d 100644 --- a/crates/welcome/src/base_keymap_picker.rs +++ b/crates/welcome/src/base_keymap_picker.rs @@ -36,13 +36,12 @@ pub fn toggle( } pub struct BaseKeymapSelector { - focus_handle: gpui::FocusHandle, picker: View>, } impl FocusableView for BaseKeymapSelector { - fn focus_handle(&self, _cx: &AppContext) -> gpui::FocusHandle { - self.focus_handle.clone() + fn focus_handle(&self, cx: &AppContext) -> gpui::FocusHandle { + self.picker.focus_handle(cx) } } @@ -55,17 +54,13 @@ impl BaseKeymapSelector { cx: &mut ViewContext, ) -> Self { let picker = cx.new_view(|cx| Picker::new(delegate, cx)); - let focus_handle = cx.focus_handle(); - Self { - focus_handle, - picker, - } + Self { picker } } } impl Render for BaseKeymapSelector { fn render(&mut self, _cx: &mut ViewContext) -> impl IntoElement { - self.picker.clone() + v_stack().w(rems(34.)).child(self.picker.clone()) } } @@ -184,7 +179,13 @@ impl PickerDelegate for BaseKeymapSelectorDelegate { .ok(); } - fn dismissed(&mut self, _cx: &mut ViewContext>) {} + fn dismissed(&mut self, cx: &mut ViewContext>) { + self.view + .update(cx, |_, cx| { + cx.emit(DismissEvent); + }) + .log_err(); + } fn render_match( &self,