aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/input/keyboard.rs
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2023-12-08 09:28:50 +0400
committerGitHub <noreply@github.com>2023-12-08 09:28:50 +0400
commite12c750edb776ace9d7f6d302786f5dd06d6e968 (patch)
treeeeb9dde7abc3daded2ea803435bc2ddc2954507c /alacritty/src/input/keyboard.rs
parent1a143d11d3296816bef1ea5b1a0b7bf54b92f4a5 (diff)
downloadr-alacritty-e12c750edb776ace9d7f6d302786f5dd06d6e968.tar.gz
r-alacritty-e12c750edb776ace9d7f6d302786f5dd06d6e968.tar.bz2
r-alacritty-e12c750edb776ace9d7f6d302786f5dd06d6e968.zip
Don't emit text for NamedKey without text repr
When the key doesn't have textual representation we shouldn't emit the text for them, since they are processed via bindings. Also, fix the logic to handle named keys with disambiguate without special modes/modifiers. Fixes #7423.
Diffstat (limited to 'alacritty/src/input/keyboard.rs')
-rw-r--r--alacritty/src/input/keyboard.rs22
1 files changed, 13 insertions, 9 deletions
diff --git a/alacritty/src/input/keyboard.rs b/alacritty/src/input/keyboard.rs
index 94633cb1..9db67f42 100644
--- a/alacritty/src/input/keyboard.rs
+++ b/alacritty/src/input/keyboard.rs
@@ -107,15 +107,19 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> {
mods: ModifiersState,
) -> bool {
if mode.contains(TermMode::REPORT_ALL_KEYS_AS_ESC) {
- true
- } else if mode.contains(TermMode::DISAMBIGUATE_ESC_CODES) {
- let on_numpad = key.location == KeyLocation::Numpad;
- let is_escape = key.logical_key == Key::Named(NamedKey::Escape);
- is_escape || (!mods.is_empty() && mods != ModifiersState::SHIFT) || on_numpad
- } else {
- // `Delete` key always has text attached to it, but it's a named key, thus needs to be
- // excluded here as well.
- text.is_empty() || key.logical_key == Key::Named(NamedKey::Delete)
+ return true;
+ }
+
+ let disambiguate = mode.contains(TermMode::DISAMBIGUATE_ESC_CODES)
+ && (key.logical_key == Key::Named(NamedKey::Escape)
+ || (!mods.is_empty() && mods != ModifiersState::SHIFT)
+ || key.location == KeyLocation::Numpad);
+
+ match key.logical_key {
+ _ if disambiguate => true,
+ // Exclude all the named keys unless they have textual representation.
+ Key::Named(named) => named.to_text().is_none(),
+ _ => text.is_empty(),
}
}