From 91f252c882755124d186e7bd47d3dc0c5b5ba9fc Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Thu, 13 Mar 2025 15:05:59 -0600 Subject: [PATCH] Clear selection on Ctrl+C, part of #236 --- src/main.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 913dc01..5f07019 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1823,9 +1823,15 @@ impl Application for App { if let Some(tab_model) = self.pane_model.active() { let entity = entity_opt.unwrap_or_else(|| tab_model.active()); if let Some(terminal) = tab_model.data::>(entity) { - let terminal = terminal.lock().unwrap(); - let term = terminal.term.lock(); + let mut terminal = terminal.lock().unwrap(); + let mut term = terminal.term.lock(); if let Some(text) = term.selection_to_string() { + // Clear selection (to allow next Ctrl+C to signal) + term.selection = None; + drop(term); + // Mark as dirty + terminal.needs_update = true; + drop(terminal); return Task::batch([clipboard::write(text), self.update_focus()]); } else { // Drop the lock for term so that input_scroll doesn't block forever