From f43a6d4a5591a0286e01de737be7b3f42416898b Mon Sep 17 00:00:00 2001 From: akbash Date: Thu, 16 Jul 2026 21:57:20 +0300 Subject: fix: preserve selection when auto-copy is disabled (#1496) refs #1471 Co-authored-by: akbash-bot <300245827+akbash-bot@users.noreply.github.com> --- src/app/mod.rs | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'src/app/mod.rs') diff --git a/src/app/mod.rs b/src/app/mod.rs index 8909fb1f..578ea0cd 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -1392,16 +1392,6 @@ impl App { .clamp(self.state.sidebar_min_width, self.state.sidebar_max_width); self.state.mouse_capture = config.ui.mouse_capture; self.state.copy_on_select = config.ui.copy_on_select; - if !self.state.copy_on_select { - if self.state.mode == Mode::Copy { - self.state.stop_selection_autoscroll_state(); - } else { - self.state.clear_selection(); - } - self.last_pane_click = None; - self.selection_autoscroll_deadline = None; - self.selection_highlight_clear_deadline = None; - } if self.state.redraw_on_focus_gained != config.ui.redraw_on_focus_gained { self.state.request_client_config_reload = true; } @@ -2629,11 +2619,14 @@ mod tests { assert_eq!(app.state.agent_panel_sort, state::AgentPanelSort::Priority); assert!(!app.state.redraw_on_focus_gained); assert!(!app.state.copy_on_select); - assert!(app.state.selection.is_none()); - assert!(app.state.selection_autoscroll.is_none()); - assert!(app.selection_autoscroll_deadline.is_none()); - assert!(app.selection_highlight_clear_deadline.is_none()); - assert!(app.last_pane_click.is_none()); + assert!(app.state.selection.is_some()); + assert!(app.state.selection_autoscroll.is_some()); + assert_eq!(app.selection_autoscroll_deadline, Some(selection_deadline)); + assert_eq!( + app.selection_highlight_clear_deadline, + Some(selection_deadline) + ); + assert!(app.last_pane_click.is_some()); app.state.mode = Mode::Copy; app.state.selection = Some(crate::selection::Selection::range( -- cgit v1.2.3