mirror of
https://github.com/alacritty/alacritty.git
synced 2025-02-17 15:57:08 -05:00
Prefer logical key for named keys
Some keyboard layouts have named logical keys via shift combinations of some sorts. So prefer them. Fixes #7076.
This commit is contained in:
parent
04ea367e3b
commit
fe2df1b5b2
1 changed files with 11 additions and 3 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue