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:
parent
fa6fd959e0
commit
63d5c00af9
@ -474,6 +474,7 @@ pub enum CopyModeAssignment {
|
|||||||
MoveToScrollbackTop,
|
MoveToScrollbackTop,
|
||||||
MoveToScrollbackBottom,
|
MoveToScrollbackBottom,
|
||||||
SetSelectionMode(Option<SelectionMode>),
|
SetSelectionMode(Option<SelectionMode>),
|
||||||
|
ClearSelectionMode,
|
||||||
MoveToStartOfLineContent,
|
MoveToStartOfLineContent,
|
||||||
MoveToEndOfLineContent,
|
MoveToEndOfLineContent,
|
||||||
MoveToStartOfLine,
|
MoveToStartOfLine,
|
||||||
|
@ -824,10 +824,7 @@ impl CopyRenderable {
|
|||||||
|
|
||||||
fn set_selection_mode(&mut self, mode: &Option<SelectionMode>) {
|
fn set_selection_mode(&mut self, mode: &Option<SelectionMode>) {
|
||||||
match mode {
|
match mode {
|
||||||
None => {
|
None => self.clear_selection_mode(),
|
||||||
self.start.take();
|
|
||||||
self.clear_selection();
|
|
||||||
}
|
|
||||||
Some(mode) => {
|
Some(mode) => {
|
||||||
if self.start.is_none() {
|
if self.start.is_none() {
|
||||||
let coord = SelectionCoordinate::x_y(self.cursor.x, self.cursor.y);
|
let coord = SelectionCoordinate::x_y(self.cursor.x, self.cursor.y);
|
||||||
@ -835,8 +832,7 @@ impl CopyRenderable {
|
|||||||
} else if self.selection_mode == *mode {
|
} else if self.selection_mode == *mode {
|
||||||
// We have a selection and we're trying to set the same 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
|
// again; consider this to be a toggle that clears the selection
|
||||||
self.start.take();
|
self.clear_selection_mode();
|
||||||
self.clear_selection();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
self.selection_mode = *mode;
|
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 {
|
impl Pane for CopyOverlay {
|
||||||
@ -936,6 +937,7 @@ impl Pane for CopyOverlay {
|
|||||||
EditPattern => render.edit_pattern(),
|
EditPattern => render.edit_pattern(),
|
||||||
AcceptPattern => render.accept_pattern(),
|
AcceptPattern => render.accept_pattern(),
|
||||||
SetSelectionMode(mode) => render.set_selection_mode(mode),
|
SetSelectionMode(mode) => render.set_selection_mode(mode),
|
||||||
|
ClearSelectionMode => render.clear_selection_mode(),
|
||||||
MoveBackwardSemanticZone => render.move_by_zone(-1, None),
|
MoveBackwardSemanticZone => render.move_by_zone(-1, None),
|
||||||
MoveForwardSemanticZone => render.move_by_zone(1, None),
|
MoveForwardSemanticZone => render.move_by_zone(1, None),
|
||||||
MoveBackwardZoneOfType(zone_type) => render.move_by_zone(-1, Some(*zone_type)),
|
MoveBackwardZoneOfType(zone_type) => render.move_by_zone(-1, Some(*zone_type)),
|
||||||
|
Loading…
Reference in New Issue
Block a user