From 7858f652fb6a49e1dee44a47864492d0212e57d3 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sun, 8 May 2022 22:34:36 -0700 Subject: [PATCH] input: fix ALT when used for the leader key The issue here was that we'd try to match this: ``` key_event RawKeyEvent { key: Char('t'), modifiers: ALT | LEFT_ALT, phys_code: Some(T), raw_code: 17, repeat_count: 1, key_is_down: true, handled: Handled(false) } ``` which has mods=`ALT|LEFT_ALT` against `ALT` and would fail. We need to strip out the positional ALTs from the modifiers in order to successfully match. refs: https://github.com/wez/wezterm/issues/1958 --- docs/changelog.md | 1 + wezterm-gui/src/inputmap.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/changelog.md b/docs/changelog.md index 733ca6720..aefa58d6e 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -49,6 +49,7 @@ As features stabilize some brief notes about them will accumulate here. * Scrollbar stopped working after a lot of output scrolled outside of the scrollback limit. Thanks to [@davidrios](https://github.com/davidrios)! [#1866](https://github.com/wez/wezterm/pull/1866) * Windows: uncommitted IME composition could get stuck when switching input methods. [#1922](https://github.com/wez/wezterm/issues/1922) * OSC sequences, such as those that change the window or tab title, that accept a single string parameter will now join multiple parameters together. This allows window and tab titles to contain a semicolo. Thanks to [@kumattau](https://github.com/kumattau)! [#1939](https://github.com/wez/wezterm/pull/1939) +* Unable to use `ALT` as a modifier for the `leader` key. [#1958](https://github.com/wez/wezterm/issues/1958) ### 20220408-101518-b908e2dd diff --git a/wezterm-gui/src/inputmap.rs b/wezterm-gui/src/inputmap.rs index 2019ec0a6..56541abec 100644 --- a/wezterm-gui/src/inputmap.rs +++ b/wezterm-gui/src/inputmap.rs @@ -214,7 +214,7 @@ impl InputMap { pub fn is_leader(&self, key: &KeyCode, mods: Modifiers) -> Option { if let Some((leader_key, leader_mods, timeout)) = self.leader.as_ref() { - if *leader_key == *key && *leader_mods == mods { + if *leader_key == *key && *leader_mods == Self::remove_positional_alt(mods) { return Some(timeout.clone()); } }