From 48417866ccaf2e5e7c0ede81d2cbc63f900fe06b Mon Sep 17 00:00:00 2001 From: smit <0xtimsb@gmail.com> Date: Wed, 19 Feb 2025 14:43:59 +0530 Subject: [PATCH] terminal: Handle shift+click selection (#25143) Closes #16951 Handle the case where you click on the terminal while pressing Shift. Instead of setting a new selection head, we simply update the selection to that point. This allows you to repeatedly extend the selection to new points by pressing Shift while preserving the original selection head. Preview: Selection works in direct terminal, but doesn't on Vim like program, which is expected. https://github.com/user-attachments/assets/e46987d8-a9a3-495d-8dd9-98d461317a8d Release Notes: - Added ability to extend selection with Shift + click in the terminal. --- crates/terminal/src/terminal.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/terminal/src/terminal.rs b/crates/terminal/src/terminal.rs index ec95fa1aca805fcada44a6426395756420bee6bd..e87333ba0cc7b55488244ce0442445433d901d34 100644 --- a/crates/terminal/src/terminal.rs +++ b/crates/terminal/src/terminal.rs @@ -1512,6 +1512,12 @@ impl Terminal { _ => None, }; + if selection_type == Some(SelectionType::Simple) && e.modifiers.shift { + self.events + .push_back(InternalEvent::UpdateSelection(position)); + return; + } + let selection = selection_type .map(|selection_type| Selection::new(selection_type, point, side));