hold shift and click to add to selection

This commit is contained in:
nludwig 2025-12-23 16:12:52 -08:00
parent 88438642a6
commit 4983e05f01

View file

@ -1145,6 +1145,16 @@ where
} else { } else {
TermSide::Right TermSide::Right
}; };
// Check if shift is pressed and there's an existing selection to extend
if state.modifiers.shift() {
let mut term = terminal.term.lock();
if let Some(ref mut selection) = term.selection {
selection.update(location, side);
} else {
term.selection =
Some(Selection::new(SelectionType::Simple, location, side));
}
} else {
let selection = match click_kind { let selection = match click_kind {
ClickKind::Single => { ClickKind::Single => {
Selection::new(SelectionType::Simple, location, side) Selection::new(SelectionType::Simple, location, side)
@ -1156,7 +1166,6 @@ where
Selection::new(SelectionType::Lines, location, side) Selection::new(SelectionType::Lines, location, side)
} }
}; };
{
let mut term = terminal.term.lock(); let mut term = terminal.term.lock();
term.selection = Some(selection); term.selection = Some(selection);
} }