summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2023-12-28 22:30:51 +0400
committerChristian Duerr <contact@christianduerr.com>2024-01-06 08:59:54 +0100
commit9957597e22bf5af8b8b0fd852fb1b441ea0ea208 (patch)
treee6ddecac0f3a2dc2c84abcc7e722e503ecd997e7
parent01d7640569e063f9e7e0d34d8869a14bf9e1dd49 (diff)
downloadalacritty-9957597e22bf5af8b8b0fd852fb1b441ea0ea208.tar.gz
alacritty-9957597e22bf5af8b8b0fd852fb1b441ea0ea208.zip
Use pre-composed key for `Alt` bindings on macOS
Fixes #7475.
-rw-r--r--CHANGELOG.md1
-rw-r--r--alacritty/src/input/keyboard.rs8
2 files changed, 8 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f68cb5ed..a32f317b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed
- `alacritty migrate` failing with nonexistent imports
+- `Alt` bindings requiring composed key rather than pre-composed one on macOS
## 0.13.0
diff --git a/alacritty/src/input/keyboard.rs b/alacritty/src/input/keyboard.rs
index 423f8bae..6d2abea1 100644
--- a/alacritty/src/input/keyboard.rs
+++ b/alacritty/src/input/keyboard.rs
@@ -172,7 +172,13 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> {
// the time. However what we want is to manually lowercase the character to account
// for both small and capital letters on regular characters at the same time.
let logical_key = if let Key::Character(ch) = key.logical_key.as_ref() {
- Key::Character(ch.to_lowercase().into())
+ // 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() {
+ key.key_without_modifiers()
+ } else {
+ Key::Character(ch.to_lowercase().into())
+ }
} else {
key.logical_key.clone()
};