This commit is contained in:
Antonio Scandurra 2022-05-25 15:24:44 +02:00
parent 85ed7b41f1
commit a8483ba458
11 changed files with 219 additions and 65 deletions

View file

@ -1414,11 +1414,12 @@ impl MutableAppContext {
}
/// Return keystrokes that would dispatch the given action closest to the focused view, if there are any.
pub fn keystrokes_for_action(&self, action: &dyn Action) -> Option<SmallVec<[Keystroke; 2]>> {
let window_id = self.cx.platform.key_window_id()?;
let (presenter, _) = self.presenters_and_platform_windows.get(&window_id)?;
let dispatch_path = presenter.borrow().dispatch_path(&self.cx);
pub(crate) fn keystrokes_for_action(
&self,
window_id: usize,
dispatch_path: &[usize],
action: &dyn Action,
) -> Option<SmallVec<[Keystroke; 2]>> {
for view_id in dispatch_path.iter().rev() {
let view = self
.cx