From a2c6b4ad2fdc85e593f16582d38d53034fcc99ab Mon Sep 17 00:00:00 2001 From: Bruno Calza Date: Mon, 21 Oct 2024 16:44:05 -0300 Subject: [PATCH] Fix empty keystroke with simulated IME (#19414) Closes #19181 When the keystroke was empty ("") the `ime_key` was converted from `None` to `Some("")` when `with_simulated_ime` was called. That was leading to not intentional behavior when an empty keystroke was combined with `shift-up` in a keybinding `["workspace::SendKeystrokes", "shift-up "]`. By adding a `key.is_empty()` we make sure the `ime_key` keeps as `None`. This was manually tested. Release Notes: - Fixed empty keystroke with simulated ime Signed-off-by: Bruno Calza --- crates/gpui/src/platform/keystroke.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/gpui/src/platform/keystroke.rs b/crates/gpui/src/platform/keystroke.rs index 89ab8c166c..6e0da7dac2 100644 --- a/crates/gpui/src/platform/keystroke.rs +++ b/crates/gpui/src/platform/keystroke.rs @@ -146,7 +146,7 @@ impl Keystroke { "space" => Some(" ".into()), "tab" => Some("\t".into()), "enter" => Some("\n".into()), - key if !is_printable_key(key) => None, + key if !is_printable_key(key) || key.is_empty() => None, key => { if self.modifiers.shift { Some(key.to_uppercase())