From b0f21ed2cb85613050b794bf6c78a7c367a94e0d Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Mon, 14 Sep 2026 15:47:53 -0400 Subject: feat: add cursor-based editing to text inputs (#3698) * feat: add cursor-based editing to text inputs refs #1803 * fix: preserve dialog actions with associated text refs #1803 * refactor: simplify text editor outcomes and tests refs #1803 --------- Co-authored-by: JJ Liebig --- src/client/shell/input.rs | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'src/client/shell/input.rs') diff --git a/src/client/shell/input.rs b/src/client/shell/input.rs index eb1f8f2f..c6d458c8 100644 --- a/src/client/shell/input.rs +++ b/src/client/shell/input.rs @@ -14,9 +14,10 @@ pub(super) fn is_modal_paste_shortcut_for_platform( key: &crate::input::TerminalKey, macos: bool, ) -> bool { - matches!(key.code, KeyCode::Char('v' | 'V')) - && (key.modifiers.contains(KeyModifiers::CONTROL) - || macos && key.modifiers.contains(KeyModifiers::SUPER)) + key.generated_text.as_deref().is_none_or(str::is_empty) + && matches!(key.code, KeyCode::Char('v' | 'V')) + && (key.modifiers.difference(KeyModifiers::SHIFT) == KeyModifiers::CONTROL + || macos && key.modifiers.difference(KeyModifiers::SHIFT) == KeyModifiers::SUPER) } fn is_modal_paste_shortcut(key: &crate::input::TerminalKey) -> bool { @@ -444,12 +445,14 @@ impl ClientShellState { { return false; } - if self - .copy_mode - .as_ref() - .is_some_and(|copy_mode| copy_mode.search_prompt.is_some()) + if self.mode == ClientShellMode::Copy + && self.overlay.is_none() + && self + .copy_mode + .as_ref() + .is_some_and(|copy_mode| copy_mode.search_prompt.is_some()) { - return self.overlay.is_none(); + return true; } matches!( self.overlay.as_ref(), @@ -609,7 +612,12 @@ impl ClientShellState { None } ClientShellMode::Copy => { - if crate::config::terminal_key_matches_combo(key, self.config.keybinds.prefix) { + if self + .copy_mode + .as_ref() + .is_none_or(|copy_mode| copy_mode.search_prompt.is_none()) + && crate::config::terminal_key_matches_combo(key, self.config.keybinds.prefix) + { self.mode = ClientShellMode::Prefix; outcome.repaint = true; } else { -- cgit v1.2.3