diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2024-12-20 03:51:36 +0300 |
---|---|---|
committer | Christian Duerr <contact@christianduerr.com> | 2024-12-22 23:22:32 +0000 |
commit | 025a4a84a8c32886810d81d8ad5d1ff744138371 (patch) | |
tree | f8c9f7bf637c5cc549622a66062b0c940c9edc6f | |
parent | bf77ac52181e5cceb15a9f06997df2bd76b97994 (diff) | |
download | alacritty-025a4a84a8c32886810d81d8ad5d1ff744138371.tar.gz alacritty-025a4a84a8c32886810d81d8ad5d1ff744138371.zip |
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.
-rw-r--r-- | CHANGELOG.md | 4 | ||||
-rw-r--r-- | 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<u8 let sequence_base = context .try_build_numpad(&key) .or_else(|| context.try_build_named_kitty(&key)) - .or_else(|| context.try_build_named_normal(&key)) + .or_else(|| context.try_build_named_normal(&key, associated_text.is_some())) .or_else(|| context.try_build_control_char_or_mod(&key, &mut modifiers)) .or_else(|| context.try_build_textual(&key, associated_text)); @@ -483,14 +483,23 @@ impl SequenceBuilder { } /// Try building from [`NamedKey`]. - fn try_build_named_normal(&self, key: &KeyEvent) -> Option<SequenceBase> { + fn try_build_named_normal( + &self, + key: &KeyEvent, + has_associated_text: bool, + ) -> Option<SequenceBase> { 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('~')), |