diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-07-25 02:40:27 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-07-25 02:54:20 +0300 |
| commit | b33e5f973fc89381aa4ac72b3a31fa087ec66e23 (patch) | |
| tree | 454d9b504987052619d38157fbf7c8eb8eaff5d6 /src/app/actions.rs | |
| parent | 0065a0ef344237c4e52bf391646e7495258ee180 (diff) | |
fix: copy retained mouse selections with keyboard shortcuts
refs #1782
Diffstat (limited to 'src/app/actions.rs')
| -rw-r--r-- | src/app/actions.rs | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/app/actions.rs b/src/app/actions.rs index ff786846..d3b85c07 100644 --- a/src/app/actions.rs +++ b/src/app/actions.rs @@ -2063,7 +2063,7 @@ impl AppState { self.selection_autoscroll = None; } - pub(crate) fn copy_word_at_pane_cell( + pub(crate) fn select_word_at_pane_cell( &mut self, terminal_runtimes: &crate::terminal::TerminalRuntimeRegistry, pane_id: crate::layout::PaneId, @@ -2113,23 +2113,30 @@ impl AppState { return false; }; - // Copy the token and keep its selection visible as short-lived feedback. let mut selection = Selection::range(pane_id, viewport_row, start_col, end_col, metrics); if !selection.finish() { return false; } - let Some(text) = rt - .extract_selection(&selection) - .filter(|text| !text.is_empty()) - else { - self.clear_selection(); - return false; + let text = if self.copy_on_select { + let Some(text) = rt + .extract_selection(&selection) + .filter(|text| !text.is_empty()) + else { + self.clear_selection(); + return false; + }; + Some(text) + } else { + None }; - self.request_clipboard_write = Some(text.into_bytes()); + self.selection = Some(selection); self.selection_autoscroll = None; - info!("copied double-clicked token to clipboard"); + if let Some(text) = text { + self.request_clipboard_write = Some(text.into_bytes()); + info!("copied double-clicked token to clipboard"); + } true } @@ -2184,7 +2191,7 @@ impl AppState { Some(sel) => sel, None => return, }; - if !sel.finish() { + if !sel.is_finalized() && !sel.finish() { return; } |
