mirror of
https://github.com/wez/wezterm.git
synced 2024-11-26 16:34:23 +03:00
Ctrl-[ and Ctrl-Esc didn't send key_down until key_up
Looking closer, I think I'd misread the key event generated by
perform_key_equivalent for the ctrl-escape case as a key down.
Fixing this is fairly straightforward: when we return YES from
perform_key_equivalent we synthesize a key_down event.
macos will follow up with the key up.
We can fold two cases together in there and remove the horrible
hack style fix I just added in a4b68247bb
refs: https://github.com/wez/wezterm/issues/1877
This commit is contained in:
parent
325c1a9e91
commit
47addfa53c
@ -1998,10 +1998,7 @@ impl WindowView {
|
||||
// CTRL-Tab only delivers a key-up event, and never a
|
||||
// key-down event. So we just pretend that key-up is
|
||||
// key-down.
|
||||
// Same for CTRL-[
|
||||
// <https://github.com/wez/wezterm/issues/1877>
|
||||
let key_is_down = if (virtual_key == super::keycodes::kVK_Tab
|
||||
|| virtual_key == super::keycodes::kVK_ANSI_LeftBracket)
|
||||
let key_is_down = if virtual_key == super::keycodes::kVK_Tab
|
||||
&& modifiers.contains(Modifiers::CTRL)
|
||||
&& !key_is_down
|
||||
{
|
||||
@ -2327,7 +2324,9 @@ impl WindowView {
|
||||
modifiers,
|
||||
);
|
||||
|
||||
if chars == "." && modifiers == Modifiers::SUPER {
|
||||
if (chars == "." && modifiers == Modifiers::SUPER)
|
||||
|| (chars == "\u{1b}" && modifiers == Modifiers::CTRL)
|
||||
{
|
||||
// Synthesize a key down event for this, because macOS will
|
||||
// not do that, even though we tell it that we handled this event.
|
||||
// <https://github.com/wez/wezterm/issues/1867>
|
||||
@ -2335,12 +2334,6 @@ impl WindowView {
|
||||
|
||||
// Prevent macOS from calling doCommandBySelector(cancel:)
|
||||
YES
|
||||
} else if chars == "\u{1b}" && modifiers == Modifiers::CTRL {
|
||||
// We don't need to synthesize a key down event for this,
|
||||
// because macOS will do that once we return YES.
|
||||
// We need to return YES to prevent macOS from calling
|
||||
// doCommandBySelector(cancel:) on us.
|
||||
YES
|
||||
} else {
|
||||
// Allow macOS to process built-in shortcuts like CMD-`
|
||||
// to cycle though windows
|
||||
|
Loading…
Reference in New Issue
Block a user