From 0b7cb6550bb21456fbd15390969358874c8ae28f Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Fri, 18 Mar 2022 13:32:43 -0700 Subject: [PATCH] macos: more urgh with alt+shift key combinations refs: https://github.com/wez/wezterm/issues/760 refs: https://github.com/wez/wezterm/issues/1706 --- window/src/os/macos/window.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/window/src/os/macos/window.rs b/window/src/os/macos/window.rs index 1efe85c1b..0d09a4418 100644 --- a/window/src/os/macos/window.rs +++ b/window/src/os/macos/window.rs @@ -2203,12 +2203,18 @@ impl WindowView { && !unmod.is_empty() && modifiers.contains(Modifiers::SHIFT) && modifiers.contains(Modifiers::ALT) + && (virtual_key == super::keycodes::kVK_ANSI_Grave + || virtual_key == super::keycodes::kVK_ANSI_LeftBracket + || virtual_key == super::keycodes::kVK_ANSI_RightBracket) { // When both shift and alt are pressed, macos appears to swap `chars` with `unmod`, // which isn't particularly helpful. eg: ALT+SHIFT+` produces chars='`' and unmod='~' // In this case, we take the key from unmod. // We leave `raw` set to None as we want to preserve the value of modifiers. - // + // . + // We can't do this for every ALT+SHIFT combo, as the weird behavior doesn't + // apply to eg: ALT+SHIFT+789 for Norwegian layouts + // match key_string_to_key_code(unmod) { Some(key) => (key, None), None => return,