aboutsummaryrefslogtreecommitdiff
path: root/src/app/input/mod.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-07-25 02:40:27 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-07-25 02:54:20 +0300
commitb33e5f973fc89381aa4ac72b3a31fa087ec66e23 (patch)
tree454d9b504987052619d38157fbf7c8eb8eaff5d6 /src/app/input/mod.rs
parent0065a0ef344237c4e52bf391646e7495258ee180 (diff)
fix: copy retained mouse selections with keyboard shortcuts
refs #1782
Diffstat (limited to 'src/app/input/mod.rs')
-rw-r--r--src/app/input/mod.rs31
1 files changed, 12 insertions, 19 deletions
diff --git a/src/app/input/mod.rs b/src/app/input/mod.rs
index f304cde6..a2e6597b 100644
--- a/src/app/input/mod.rs
+++ b/src/app/input/mod.rs
@@ -36,6 +36,7 @@ fn modified_url_click_modifier_matches_terminal_mouse_reporting() {
assert_eq!(modified_url_click_modifier(), KeyModifiers::CONTROL);
}
+mod clipboard;
mod copy_mode;
mod modal;
mod mouse;
@@ -401,15 +402,7 @@ impl App {
self.save_agent_panel_sort(self.state.agent_panel_sort);
}
- if let Some(content) = self.state.request_clipboard_write.take() {
- if self
- .event_tx
- .try_send(crate::events::AppEvent::ClipboardWrite { content })
- .is_err()
- {
- tracing::warn!("failed to queue clipboard write event");
- }
- }
+ self.dispatch_pending_clipboard_write();
// Sync autoscroll deadline with state (mouse handler may have
// set or cleared selection_autoscroll during handle_mouse).
@@ -569,14 +562,12 @@ impl App {
};
// Require the second click to land near the first click in the same pane
- // and within the double-click window so adjacent interactions do not copy.
+ // and within the double-click window so adjacent interactions do not select a word.
if !self.take_pane_double_click(click) {
return false;
}
- // Preserve a short highlight after copying so the user gets visible
- // confirmation without leaving a persistent selection behind.
- self.copy_double_clicked_word(click)
+ self.select_double_clicked_word(click)
}
fn pane_click_candidate(&mut self, mouse: MouseEvent) -> Option<PaneClickState> {
@@ -620,18 +611,20 @@ impl App {
true
}
- fn copy_double_clicked_word(&mut self, click: PaneClickState) -> bool {
- let copied = self.state.copy_word_at_pane_cell(
+ fn select_double_clicked_word(&mut self, click: PaneClickState) -> bool {
+ let selected = self.state.select_word_at_pane_cell(
&self.terminal_runtimes,
click.pane_id,
click.viewport_row,
click.col,
);
- if copied {
- self.selection_highlight_clear_deadline =
- Some(std::time::Instant::now() + super::PANE_COPY_HIGHLIGHT_DURATION);
+ if selected {
+ self.selection_highlight_clear_deadline = self
+ .state
+ .copy_on_select
+ .then(|| std::time::Instant::now() + super::PANE_COPY_HIGHLIGHT_DURATION);
}
- copied
+ selected
}
}