macos: more urgh with alt+shift key combinations

refs: https://github.com/wez/wezterm/issues/760
refs: https://github.com/wez/wezterm/issues/1706
This commit is contained in:
Wez Furlong committed 2022-03-18 13:32:43 -07:00
1 parent 8c3d2f6eb6
commit 0b7cb6550b
1 file changed
+7 -1
+7 -1
View File
@@ -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.
// <https://github.com/wez/wezterm/issues/1706>
// <https://github.com/wez/wezterm/issues/1706>.
// 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
// <https://github.com/wez/wezterm/issues/760>
match key_string_to_key_code(unmod) {
Some(key) => (key, None),
None => return,