mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-06 18:46:49 +00:00
Capture node in dispatch tree even if it's not focusable
This commit is contained in:
parent
26d26fadb3
commit
827b16bf5c
1 changed files with 6 additions and 5 deletions
|
@ -305,7 +305,7 @@ pub trait KeyDispatch<V: 'static>: 'static {
|
|||
cx: &mut ViewContext<V>,
|
||||
f: impl FnOnce(Option<FocusHandle>, &mut ViewContext<V>) -> R,
|
||||
) -> R {
|
||||
if let Some(focusable) = self.as_focusable_mut() {
|
||||
let focus_handle = if let Some(focusable) = self.as_focusable_mut() {
|
||||
let focus_handle = focusable
|
||||
.focus_handle
|
||||
.get_or_insert_with(|| focus_handle.unwrap_or_else(|| cx.focus_handle()))
|
||||
|
@ -316,11 +316,12 @@ pub trait KeyDispatch<V: 'static>: 'static {
|
|||
listener(view, &focus_handle, event, cx)
|
||||
});
|
||||
}
|
||||
|
||||
cx.with_key_dispatch(self.key_context().clone(), Some(focus_handle), f)
|
||||
Some(focus_handle)
|
||||
} else {
|
||||
f(None, cx)
|
||||
}
|
||||
None
|
||||
};
|
||||
|
||||
cx.with_key_dispatch(self.key_context().clone(), focus_handle, f)
|
||||
}
|
||||
|
||||
fn refine_style(&self, style: &mut Style, cx: &WindowContext) {
|
||||
|
|
Loading…
Reference in a new issue