mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-07 02:57:34 +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>,
|
cx: &mut ViewContext<V>,
|
||||||
f: impl FnOnce(Option<FocusHandle>, &mut ViewContext<V>) -> R,
|
f: impl FnOnce(Option<FocusHandle>, &mut ViewContext<V>) -> R,
|
||||||
) -> 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
|
let focus_handle = focusable
|
||||||
.focus_handle
|
.focus_handle
|
||||||
.get_or_insert_with(|| focus_handle.unwrap_or_else(|| cx.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)
|
listener(view, &focus_handle, event, cx)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Some(focus_handle)
|
||||||
cx.with_key_dispatch(self.key_context().clone(), Some(focus_handle), f)
|
|
||||||
} else {
|
} 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) {
|
fn refine_style(&self, style: &mut Style, cx: &WindowContext) {
|
||||||
|
|
Loading…
Reference in a new issue