aboutsummaryrefslogtreecommitdiff
path: root/src/client/shell/input.rs
diff options
context:
space:
mode:
authorMark Jaquith <mark@jaquith.me>2026-09-14 15:47:53 -0400
committerGitHub <noreply@github.com>2026-09-14 21:47:53 +0200
commitb0f21ed2cb85613050b794bf6c78a7c367a94e0d (patch)
tree25c14e09338f5300bedbc8131aa23fab3d37add9 /src/client/shell/input.rs
parentd8b36691d10c6055293ad45324b22af8b8f570e5 (diff)
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 <jonathan.liebig@gmail.com>
Diffstat (limited to 'src/client/shell/input.rs')
-rw-r--r--src/client/shell/input.rs26
1 files changed, 17 insertions, 9 deletions
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 {