aboutsummaryrefslogtreecommitdiff
path: root/src/app/input/mouse.rs
diff options
context:
space:
mode:
authorakbash <akbash@herdr.dev>2026-07-16 21:57:20 +0300
committerGitHub <noreply@github.com>2026-07-16 21:57:20 +0300
commitf43a6d4a5591a0286e01de737be7b3f42416898b (patch)
tree9245146f3cc399bc6e8477d43c5de5cf3d3f1a42 /src/app/input/mouse.rs
parent616d1dd8125ece4a9102b231864cb4fc4b761497 (diff)
fix: preserve selection when auto-copy is disabled (#1496)
refs #1471 Co-authored-by: akbash-bot <300245827+akbash-bot@users.noreply.github.com>
Diffstat (limited to 'src/app/input/mouse.rs')
-rw-r--r--src/app/input/mouse.rs24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/app/input/mouse.rs b/src/app/input/mouse.rs
index 80a7be6d..6cbce83f 100644
--- a/src/app/input/mouse.rs
+++ b/src/app/input/mouse.rs
@@ -640,14 +640,12 @@ impl AppState {
mouse.row - info.inner_rect.y,
mouse.column - info.inner_rect.x,
);
- if self.copy_on_select {
- self.selection = Some(Selection::anchor(
- info.id,
- row,
- col,
- self.pane_scroll_metrics(terminal_runtimes, info.id),
- ));
- }
+ self.selection = Some(Selection::anchor(
+ info.id,
+ row,
+ col,
+ self.pane_scroll_metrics(terminal_runtimes, info.id),
+ ));
if let Some(ws_idx) = self.active {
return Some(MouseAction::FocusPane {
ws_idx,
@@ -814,10 +812,10 @@ impl AppState {
MouseEventKind::Up(MouseButton::Left) => {
// Mouse-up either finishes a drag selection or releases after a
- // double-click copy; the latter is already copied.
+ // double-click copy; the latter is already finalized.
if let Some(selection) = self.selection.as_ref() {
let was_click = selection.was_just_click();
- let was_already_copied = selection.is_done();
+ let was_finalized = selection.is_finalized();
self.workspace_press = None;
self.tab_press = None;
@@ -825,8 +823,12 @@ impl AppState {
self.selection_autoscroll = None;
if was_click {
self.selection = None;
- } else if !was_already_copied {
+ } else if was_finalized {
+ // Double-click copy already finalized this selection.
+ } else if self.copy_on_select {
self.copy_selection(terminal_runtimes);
+ } else if let Some(selection) = self.selection.as_mut() {
+ selection.finish();
}
return None;
}