1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-19 18:57:59 +03:00

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 2022-03-18 13:32:43 -07:00
parent 8c3d2f6eb6
commit 0b7cb6550b

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,