From 0cfdf0999c0edb0047597e4d4c77a3ae18c5b06f Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Wed, 6 Apr 2022 18:26:16 -0700 Subject: [PATCH] macos: send_composed_key_when_X_alt_is_pressed now ignores other mods For reasons that I cannot remember, I made `send_composed_key_when_left_alt_is_pressed` and `send_composed_key_when_right_alt_is_pressed` only take effect if only the ALT modifiers were pressed. If SHIFT or CTRL were pressed, then the purpose of `send_composed_key_when_left_alt_is_pressed` was bypassed. This commit scopes this back to the alt mods - other kinds of mods don't affect this functionality any more. refs: https://github.com/wez/wezterm/issues/1826 --- window/src/os/macos/window.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/window/src/os/macos/window.rs b/window/src/os/macos/window.rs index 9e60cc8a7..0ee06298f 100644 --- a/window/src/os/macos/window.rs +++ b/window/src/os/macos/window.rs @@ -2150,12 +2150,10 @@ impl WindowView { modifiers }; - let only_alt = (modifiers & !(Modifiers::LEFT_ALT | Modifiers::RIGHT_ALT | Modifiers::ALT)) - == Modifiers::NONE; - let only_left_alt = - (modifiers & !(Modifiers::LEFT_ALT | Modifiers::ALT)) == Modifiers::NONE; - let only_right_alt = - (modifiers & !(Modifiers::RIGHT_ALT | Modifiers::ALT)) == Modifiers::NONE; + let alt_mods = Modifiers::LEFT_ALT | Modifiers::RIGHT_ALT | Modifiers::ALT; + let only_alt = (modifiers & alt_mods) == Modifiers::ALT; + let only_left_alt = (modifiers & alt_mods) == (Modifiers::LEFT_ALT | Modifiers::ALT); + let only_right_alt = (modifiers & alt_mods) == (Modifiers::RIGHT_ALT | Modifiers::ALT); // Also respect `send_composed_key_when_(left|right)_alt_is_pressed` configs // when `use_ime` is true.