summaryrefslogtreecommitdiffstats
path: root/alacritty
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2023-12-30 19:50:35 +0400
committerGitHub <noreply@github.com>2023-12-30 19:50:35 +0400
commitc78c5f6cc057117c344331601e81c6f5778e4a4a (patch)
tree5c4281358b26be68f73ca6ae1ef07456d096f537 /alacritty
parent107c8720c3439703cfb8058e7581396af17a8529 (diff)
Send associated text for shifted numbers with kitty
Also fix the wrong ordering of base and shifted keys. Fixes #7492.
Diffstat (limited to 'alacritty')
-rw-r--r--alacritty/src/input/keyboard.rs18
1 files changed, 13 insertions, 5 deletions
diff --git a/alacritty/src/input/keyboard.rs b/alacritty/src/input/keyboard.rs
index 8e559be1..0968c0de 100644
--- a/alacritty/src/input/keyboard.rs
+++ b/alacritty/src/input/keyboard.rs
@@ -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))