1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-25 14:05:41 -05:00

Send associated text for shifted numbers with kitty

Also fix the wrong ordering of base and shifted keys.

Fixes #7492.
This commit is contained in:
Kirill Chibisov 2023-12-30 19:50:35 +04:00 committed by Christian Duerr
parent 53927d686a
commit e297c6bf0c
2 changed files with 15 additions and 5 deletions

View file

@ -13,6 +13,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- `Alt` bindings requiring composed key rather than pre-composed one on macOS
- `Alt + Control` bindings not working on Windows
- `chars = "\u000A"` action in bindings inserting `\n`
- Alternate keys not sent for `Shift + <number>` when using kitty protocol
- Alternative keys being swapped in kitty protocol implementation
## 0.13.0

View file

@ -350,17 +350,25 @@ impl SequenceBuilder {
let character = character.chars().next().unwrap();
let base_character = character.to_lowercase().next().unwrap();
let codepoint = u32::from(character);
let base_codepoint = u32::from(base_character);
let alternate_key_code = u32::from(character);
let mut unicode_key_code = u32::from(base_character);
// Try to get the base for keys which change based on modifier, like `1` for `!`.
match key.key_without_modifiers().as_ref() {
Key::Character(unmodded) if alternate_key_code == unicode_key_code => {
unicode_key_code = u32::from(unmodded.chars().next().unwrap_or(base_character));
},
_ => (),
}
// NOTE: Base layouts are ignored, since winit doesn't expose this information
// yet.
let payload = if self.mode.contains(TermMode::REPORT_ALTERNATE_KEYS)
&& codepoint != base_codepoint
&& alternate_key_code != unicode_key_code
{
format!("{codepoint}:{base_codepoint}")
format!("{unicode_key_code}:{alternate_key_code}")
} else {
codepoint.to_string()
alternate_key_code.to_string()
};
Some(SequenceBase::new(payload.into(), SequenceTerminator::Kitty))