diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ed72ade..509bbf5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ Notable changes to the `alacritty_terminal` crate are documented in its - Modifiers being out of sync for fast/synthetic input on X11 - Child process creation failing while inside a deleted directory +- Shifted key reported without a shift when using kitty keyboard protocol ## 0.15.0 diff --git a/alacritty/src/input/keyboard.rs b/alacritty/src/input/keyboard.rs index af9bfbb2..417f599b 100644 --- a/alacritty/src/input/keyboard.rs +++ b/alacritty/src/input/keyboard.rs @@ -342,18 +342,21 @@ impl SequenceBuilder { }; if character.chars().count() == 1 { - let character = character.chars().next().unwrap(); - let base_character = character.to_lowercase().next().unwrap(); + let shift = self.modifiers.contains(SequenceModifiers::SHIFT); - let alternate_key_code = u32::from(character); - let mut unicode_key_code = u32::from(base_character); + let ch = character.chars().next().unwrap(); + let unshifted_ch = if shift { ch.to_lowercase().next().unwrap() } else { ch }; + + let alternate_key_code = u32::from(ch); + let mut unicode_key_code = u32::from(unshifted_ch); // 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)); - }, - _ => (), + // + // However it should only be performed when `SHIFT` is pressed. + if shift && alternate_key_code == unicode_key_code { + if let Key::Character(unmodded) = key.key_without_modifiers().as_ref() { + unicode_key_code = u32::from(unmodded.chars().next().unwrap_or(unshifted_ch)); + } } // NOTE: Base layouts are ignored, since winit doesn't expose this information