From edd997d0f7b62f2f53bb0eed3b6ba0afcde4d8e6 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 12 Mar 2022 13:25:42 -0700 Subject: [PATCH] macos: fix CTRL-Tab refs: https://github.com/wez/wezterm/issues/1684 --- window/src/os/macos/window.rs | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/window/src/os/macos/window.rs b/window/src/os/macos/window.rs index ae9dabed2..1efe85c1b 100644 --- a/window/src/os/macos/window.rs +++ b/window/src/os/macos/window.rs @@ -1939,6 +1939,19 @@ impl WindowView { key_is_down ); + // Ungh, this is a horrible special case. + // CTRL-Tab only delivers a key-up event, and never a + // key-down event. So we just pretend that key-up is + // key-down. + let key_is_down = if virtual_key == super::keycodes::kVK_Tab + && modifiers.contains(Modifiers::CTRL) + && !key_is_down + { + true + } else { + key_is_down + }; + // `Delete` on macos is really Backspace and emits BS. // `Fn-Delete` emits DEL. // Alt-Delete is mapped by the IME to be equivalent to Fn-Delete. @@ -2216,7 +2229,7 @@ impl WindowView { modifiers }; - let mut event = KeyEvent { + let event = KeyEvent { key, modifiers, repeat_count: 1, @@ -2226,17 +2239,6 @@ impl WindowView { .normalize_ctrl() .normalize_shift(); - // Ungh, this is a horrible special case. - // CTRL-Tab only delivers a key-up event, and never a - // key-down event. So we just pretend that key-up is - // key-down. - if event.key == KeyCode::Char('\t') - && event.modifiers.contains(Modifiers::CTRL) - && !event.key_is_down - { - event.key_is_down = true; - } - log::debug!( "key_common {:?} (chars={:?} unmod={:?} modifiers={:?})", event,