aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--alacritty/src/input/keyboard.rs16
2 files changed, 16 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cf13eb7a..4c2cc6cd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,7 @@ Notable changes to the `alacritty_terminal` crate are documented in its
### Fixed
- Crash when OpenGL context resets
+- Modifier keys clearing selection with kitty keyboard protocol enabled
## 0.15.1
diff --git a/alacritty/src/input/keyboard.rs b/alacritty/src/input/keyboard.rs
index 417f599b..ccdeac3f 100644
--- a/alacritty/src/input/keyboard.rs
+++ b/alacritty/src/input/keyboard.rs
@@ -77,6 +77,7 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> {
let mods = if self.alt_send_esc(&key, text) { mods } else { mods & !ModifiersState::ALT };
let build_key_sequence = Self::should_build_sequence(&key, text, mode, mods);
+ let is_modifier_key = Self::is_modifier_key(&key);
let bytes = if build_key_sequence {
build_sequence(key, mods, mode)
@@ -92,7 +93,10 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> {
// Write only if we have something to write.
if !bytes.is_empty() {
- self.ctx.on_terminal_input_start();
+ // Don't clear selection/scroll down when writing escaped modifier keys.
+ if !is_modifier_key {
+ self.ctx.on_terminal_input_start();
+ }
self.ctx.write_to_pty(bytes);
}
}
@@ -125,6 +129,16 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> {
}
}
+ fn is_modifier_key(key: &KeyEvent) -> bool {
+ matches!(
+ key.logical_key.as_ref(),
+ Key::Named(NamedKey::Shift)
+ | Key::Named(NamedKey::Control)
+ | Key::Named(NamedKey::Alt)
+ | Key::Named(NamedKey::Super)
+ )
+ }
+
/// Check whether we should try to build escape sequence for the [`KeyEvent`].
fn should_build_sequence(
key: &KeyEvent,