aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/input.rs
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2023-07-13 15:43:19 +0000
committerGitHub <noreply@github.com>2023-07-13 15:43:19 +0000
commitfe2df1b5b22b573e74ab967b832566f4f5d549e7 (patch)
treeed0ae2b6f829734d8ba256acabb947868700fb3d /alacritty/src/input.rs
parent04ea367e3baa7e51933e9a595da793b4c8a4aa8f (diff)
downloadr-alacritty-fe2df1b5b22b573e74ab967b832566f4f5d549e7.tar.gz
r-alacritty-fe2df1b5b22b573e74ab967b832566f4f5d549e7.tar.bz2
r-alacritty-fe2df1b5b22b573e74ab967b832566f4f5d549e7.zip
Prefer logical key for named keys
Some keyboard layouts have named logical keys via shift combinations of some sorts. So prefer them. Fixes #7076.
Diffstat (limited to 'alacritty/src/input.rs')
-rw-r--r--alacritty/src/input.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/alacritty/src/input.rs b/alacritty/src/input.rs
index f43d9ec7..19996c72 100644
--- a/alacritty/src/input.rs
+++ b/alacritty/src/input.rs
@@ -23,7 +23,7 @@ use winit::event::{
use winit::event_loop::EventLoopWindowTarget;
#[cfg(target_os = "macos")]
use winit::keyboard::ModifiersKeyState;
-use winit::keyboard::ModifiersState;
+use winit::keyboard::{Key, ModifiersState};
#[cfg(target_os = "macos")]
use winit::platform::macos::{EventLoopWindowTargetExtMacOS, OptionAsAlt};
use winit::platform::modifier_supplement::KeyEventExtModifierSupplement;
@@ -1050,9 +1050,17 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> {
for i in 0..self.ctx.config().key_bindings().len() {
let binding = &self.ctx.config().key_bindings()[i];
- let key = match (&binding.trigger, &key.key_without_modifiers()) {
+ // When the logical key is some named key, use it, otherwise fallback to
+ // key without modifiers to account for bindings.
+ let logical_key = if matches!(key.logical_key, Key::Character(_)) {
+ key.key_without_modifiers()
+ } else {
+ key.logical_key.clone()
+ };
+
+ let key = match (&binding.trigger, logical_key) {
(BindingKey::Scancode(_), _) => BindingKey::Scancode(key.physical_key),
- (_, code) => BindingKey::Keycode { key: code.clone(), location: key.location },
+ (_, code) => BindingKey::Keycode { key: code, location: key.location },
};
if binding.is_triggered_by(mode, mods, &key) {