aboutsummaryrefslogtreecommitdiff
path: root/src/app/actions.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-04-09 17:51:28 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-04-09 17:52:09 +0300
commit953ff58e9febfc428ebef4db98e3b496ba487d69 (patch)
tree9ad7b9308fa73cac0a8c1876fcd8d58264d4d1ad /src/app/actions.rs
parentbe271f8dbe6abd9593cdf832e1cc6e1108df6fab (diff)
fix: autoscroll and clear mouse text selections
Diffstat (limited to 'src/app/actions.rs')
-rw-r--r--src/app/actions.rs42
1 files changed, 27 insertions, 15 deletions
diff --git a/src/app/actions.rs b/src/app/actions.rs
index 3622787e..6989a909 100644
--- a/src/app/actions.rs
+++ b/src/app/actions.rs
@@ -357,33 +357,45 @@ impl AppState {
}
pub fn copy_selection(&mut self) {
- let sel = match self.selection.as_mut() {
- Some(s) => {
- if !s.finish() {
+ let text = {
+ let sel = match self.selection.as_mut() {
+ Some(s) => {
+ if !s.finish() {
+ self.selection = None;
+ return;
+ }
+ s
+ }
+ None => return,
+ };
+
+ let ws = match self.active.and_then(|i| self.workspaces.get(i)) {
+ Some(ws) => ws,
+ None => {
self.selection = None;
return;
}
- s
- }
- None => return,
- };
+ };
- let ws = match self.active.and_then(|i| self.workspaces.get(i)) {
- Some(ws) => ws,
- None => return,
- };
+ let rt = match ws.runtime(sel.pane_id) {
+ Some(r) => r,
+ None => {
+ self.selection = None;
+ return;
+ }
+ };
- let rt = match ws.runtime(sel.pane_id) {
- Some(r) => r,
- None => return,
+ rt.extract_selection(sel)
};
- if let Some(text) = rt.extract_selection(sel) {
+ if let Some(text) = text {
if !text.is_empty() {
crate::selection::write_osc52(&text);
info!(len = text.len(), "copied selection to clipboard");
}
}
+
+ self.selection = None;
}
}