aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2025-01-04 08:40:17 +0300
committerGitHub <noreply@github.com>2025-01-04 08:40:17 +0300
commit7bda13b8aa59ed7bc3efe6d5b0bdb09b8e75f8a3 (patch)
tree1075efc9227c38e7ba4a10515dc62280ac5a0768
parentc5fccfd980fba9e119655165a7efc8c2ddd59180 (diff)
downloadalacritty-7bda13b8aa59ed7bc3efe6d5b0bdb09b8e75f8a3.tar.gz
alacritty-7bda13b8aa59ed7bc3efe6d5b0bdb09b8e75f8a3.zip
Fix report of Enter/Tab/Backspace in kitty keyboard
The behavior changed and now it actually makes sense. Fix #8385.
-rw-r--r--CHANGELOG.md1
-rw-r--r--alacritty/src/input/keyboard.rs21
2 files changed, 9 insertions, 13 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2a9efb5f..f23f442f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -28,6 +28,7 @@ Notable changes to the `alacritty_terminal` crate are documented in its
- `alacritty migrate` crashing with recursive toml imports
- Migrating nonexistent toml import breaking the entire migration
- First daemon mode window ignoring window options passed through CLI
+- Report of Enter/Tab/Backspace in kitty keyboard's report event types mode
## 0.14.0
diff --git a/alacritty/src/input/keyboard.rs b/alacritty/src/input/keyboard.rs
index 85734109..af9bfbb2 100644
--- a/alacritty/src/input/keyboard.rs
+++ b/alacritty/src/input/keyboard.rs
@@ -218,20 +218,15 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> {
let text = key.text_with_all_modifiers().unwrap_or_default();
let mods = if self.alt_send_esc(&key, text) { mods } else { mods & !ModifiersState::ALT };
- let bytes: Cow<'static, [u8]> = match key.logical_key.as_ref() {
- // NOTE: Echo the key back on release to follow kitty/foot behavior. When
- // KEYBOARD_REPORT_ALL_KEYS_AS_ESC is used, we build proper escapes for
- // the keys below.
- _ if mode.contains(TermMode::REPORT_ALL_KEYS_AS_ESC) => {
- build_sequence(key, mods, mode).into()
+ let bytes = match key.logical_key.as_ref() {
+ Key::Named(NamedKey::Enter)
+ | Key::Named(NamedKey::Tab)
+ | Key::Named(NamedKey::Backspace)
+ if !mode.contains(TermMode::REPORT_ALL_KEYS_AS_ESC) =>
+ {
+ return
},
- // Winit uses different keys for `Backspace` so we explicitly specify the
- // values, instead of using what was passed to us from it.
- Key::Named(NamedKey::Tab) => [b'\t'].as_slice().into(),
- Key::Named(NamedKey::Enter) => [b'\r'].as_slice().into(),
- Key::Named(NamedKey::Backspace) => [b'\x7f'].as_slice().into(),
- Key::Named(NamedKey::Escape) => [b'\x1b'].as_slice().into(),
- _ => build_sequence(key, mods, mode).into(),
+ _ => build_sequence(key, mods, mode),
};
self.ctx.write_to_pty(bytes);