Skip to content

Commit eb21e87

Browse files
committed
Match Command::Tab/Escape, not NamedKey::Tab/Escape
This supports mapping to these keys in shortcuts
1 parent caf45f9 commit eb21e87

File tree

1 file changed

+6
-6
lines changed
  • crates/kas-core/src/event/cx

1 file changed

+6
-6
lines changed

crates/kas-core/src/event/cx/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -464,15 +464,15 @@ impl<'a> EventCx<'a> {
464464
widget.id()
465465
);
466466

467-
let opt_command = self.config.shortcuts().try_match(self.modifiers, &vkey);
467+
let opt_cmd = self.config.shortcuts().try_match(self.modifiers, &vkey);
468468

469-
if Some(Command::Exit) == opt_command {
469+
if Some(Command::Exit) == opt_cmd {
470470
self.runner.exit();
471471
return;
472-
} else if Some(Command::Close) == opt_command {
472+
} else if Some(Command::Close) == opt_cmd {
473473
self.handle_close();
474474
return;
475-
} else if let Some(cmd) = opt_command {
475+
} else if let Some(cmd) = opt_cmd {
476476
let mut targets = vec![];
477477
let mut send = |_self: &mut Self, id: Id, cmd| -> bool {
478478
if !targets.contains(&id) {
@@ -548,10 +548,10 @@ impl<'a> EventCx<'a> {
548548
}
549549
let event = Event::Command(Command::Activate, Some(code));
550550
self.send_event(widget, id, event);
551-
} else if self.config.nav_focus && vkey == Key::Named(NamedKey::Tab) {
551+
} else if self.config.nav_focus && opt_cmd == Some(Command::Tab) {
552552
let shift = self.modifiers.shift_key();
553553
self.next_nav_focus_impl(widget.re(), None, shift, FocusSource::Key);
554-
} else if vkey == Key::Named(NamedKey::Escape) {
554+
} else if opt_cmd == Some(Command::Escape) {
555555
if let Some(id) = self.popups.last().map(|(id, _, _)| *id) {
556556
self.close_window(id);
557557
}

0 commit comments

Comments
 (0)