1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-20 11:17:15 +03:00

Add new action CopyMode('ClearSelectionMode')

This commit is contained in:
aznhe21 2022-08-03 18:23:09 +09:00 committed by Wez Furlong
parent fa6fd959e0
commit 63d5c00af9
2 changed files with 9 additions and 6 deletions

View File

@ -474,6 +474,7 @@ pub enum CopyModeAssignment {
MoveToScrollbackTop,
MoveToScrollbackBottom,
SetSelectionMode(Option<SelectionMode>),
ClearSelectionMode,
MoveToStartOfLineContent,
MoveToEndOfLineContent,
MoveToStartOfLine,

View File

@ -824,10 +824,7 @@ impl CopyRenderable {
fn set_selection_mode(&mut self, mode: &Option<SelectionMode>) {
match mode {
None => {
self.start.take();
self.clear_selection();
}
None => self.clear_selection_mode(),
Some(mode) => {
if self.start.is_none() {
let coord = SelectionCoordinate::x_y(self.cursor.x, self.cursor.y);
@ -835,8 +832,7 @@ impl CopyRenderable {
} else if self.selection_mode == *mode {
// We have a selection and we're trying to set the same mode
// again; consider this to be a toggle that clears the selection
self.start.take();
self.clear_selection();
self.clear_selection_mode();
return;
}
self.selection_mode = *mode;
@ -844,6 +840,11 @@ impl CopyRenderable {
}
}
}
fn clear_selection_mode(&mut self) {
self.start.take();
self.clear_selection();
}
}
impl Pane for CopyOverlay {
@ -936,6 +937,7 @@ impl Pane for CopyOverlay {
EditPattern => render.edit_pattern(),
AcceptPattern => render.accept_pattern(),
SetSelectionMode(mode) => render.set_selection_mode(mode),
ClearSelectionMode => render.clear_selection_mode(),
MoveBackwardSemanticZone => render.move_by_zone(-1, None),
MoveForwardSemanticZone => render.move_by_zone(1, None),
MoveBackwardZoneOfType(zone_type) => render.move_by_zone(-1, Some(*zone_type)),