From 025a4a84a8c32886810d81d8ad5d1ff744138371 Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Fri, 20 Dec 2024 03:51:36 +0300 Subject: Always explicitly emit `1` without modifiers in kitty encoding While this doesn't change much with how parsers are implemented, it improves consistency with how key release is handled. --- CHANGELOG.md | 4 ++++ alacritty/src/input/keyboard.rs | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bdea611..9b6b971e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ Notable changes to the `alacritty_terminal` crate are documented in its ## 0.15.0-dev +### Changed + +- Always emit `1` for the first parameter when having modifiers in kitty keyboard protocol + ### Fixed - Mouse/Vi cursor hint highlighting broken on the terminal cursor line diff --git a/alacritty/src/input/keyboard.rs b/alacritty/src/input/keyboard.rs index 14755594..85734109 100644 --- a/alacritty/src/input/keyboard.rs +++ b/alacritty/src/input/keyboard.rs @@ -280,7 +280,7 @@ fn build_sequence(key: KeyEvent, mods: ModifiersState, mode: TermMode) -> Vec Option { + fn try_build_named_normal( + &self, + key: &KeyEvent, + has_associated_text: bool, + ) -> Option { let named = match key.logical_key { Key::Named(named) => named, _ => return None, }; // The default parameter is 1, so we can omit it. - let one_based = if self.modifiers.is_empty() && !self.kitty_event_type { "" } else { "1" }; + let one_based = + if self.modifiers.is_empty() && !self.kitty_event_type && !has_associated_text { + "" + } else { + "1" + }; let (base, terminator) = match named { NamedKey::PageUp => ("5", SequenceTerminator::Normal('~')), NamedKey::PageDown => ("6", SequenceTerminator::Normal('~')), -- cgit v1.2.3-54-g00ecf