diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2023-12-30 08:53:14 +0400 |
---|---|---|
committer | Christian Duerr <contact@christianduerr.com> | 2024-01-06 08:59:54 +0100 |
commit | 1991496eb1446cc7bc549acf61b7388a1192a279 (patch) | |
tree | 9a1d33aa36e66bd435dbb0b3d48ea38df4ae3114 | |
parent | 9957597e22bf5af8b8b0fd852fb1b441ea0ea208 (diff) | |
download | alacritty-1991496eb1446cc7bc549acf61b7388a1192a279.tar.gz alacritty-1991496eb1446cc7bc549acf61b7388a1192a279.zip |
Fix inability to bind `Alt+Control` on Windows
Fixes #7506.
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | alacritty/src/input/keyboard.rs | 9 |
2 files changed, 9 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index a32f317b..61260731 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - `alacritty migrate` failing with nonexistent imports - `Alt` bindings requiring composed key rather than pre-composed one on macOS +- `Alt + Control` bindings not working on Windows ## 0.13.0 diff --git a/alacritty/src/input/keyboard.rs b/alacritty/src/input/keyboard.rs index 6d2abea1..8e559be1 100644 --- a/alacritty/src/input/keyboard.rs +++ b/alacritty/src/input/keyboard.rs @@ -174,7 +174,14 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> { let logical_key = if let Key::Character(ch) = key.logical_key.as_ref() { // Match `Alt` bindings without `Alt` being applied, otherwise they use the // composed chars, which are not intuitive to bind. - if cfg!(target_os = "macos") && mods.alt_key() { + // + // On Windows, the `Ctrl + Alt` mangles `logical_key` to unidentified values, thus + // preventing them from being used in bindings + // + // For more see https://github.com/rust-windowing/winit/issues/2945. + if (cfg!(target_os = "macos") || (cfg!(windows) && mods.control_key())) + && mods.alt_key() + { key.key_without_modifiers() } else { Key::Character(ch.to_lowercase().into()) |