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
|
// CTRL-Tab only delivers a key-up event, and never a
|
||||||
// key-down event. So we just pretend that key-up is
|
// key-down event. So we just pretend that key-up is
|
||||||
// key-down.
|
// key-down.
|
||||||
// Same for CTRL-[
|
let key_is_down = if virtual_key == super::keycodes::kVK_Tab
|
||||||
// <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)
|
|
||||||
&& modifiers.contains(Modifiers::CTRL)
|
&& modifiers.contains(Modifiers::CTRL)
|
||||||
&& !key_is_down
|
&& !key_is_down
|
||||||
{
|
{
|
||||||
@ -2327,7 +2324,9 @@ impl WindowView {
|
|||||||
modifiers,
|
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
|
// Synthesize a key down event for this, because macOS will
|
||||||
// not do that, even though we tell it that we handled this event.
|
// not do that, even though we tell it that we handled this event.
|
||||||
// <https://github.com/wez/wezterm/issues/1867>
|
// <https://github.com/wez/wezterm/issues/1867>
|
||||||
@ -2335,12 +2334,6 @@ impl WindowView {
|
|||||||
|
|
||||||
// Prevent macOS from calling doCommandBySelector(cancel:)
|
// Prevent macOS from calling doCommandBySelector(cancel:)
|
||||||
YES
|
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 {
|
} else {
|
||||||
// Allow macOS to process built-in shortcuts like CMD-`
|
// Allow macOS to process built-in shortcuts like CMD-`
|
||||||
// to cycle though windows
|
// to cycle though windows
|
||||||
|
Loading…
Reference in New Issue
Block a user