diff options
author | Christian Duerr <chrisduerr@users.noreply.github.com> | 2019-06-20 15:56:09 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-20 15:56:09 +0000 |
commit | e0a286515f12c6ceed53c74df1c10123cb0b550d (patch) | |
tree | e24c9fc28984cdc577fd87b47c36d72c82ab3368 /alacritty_terminal/src/input.rs | |
parent | a1c70b1d68f192c3e6901095f646e17a93774746 (diff) | |
download | alacritty-e0a286515f12c6ceed53c74df1c10123cb0b550d.tar.gz alacritty-e0a286515f12c6ceed53c74df1c10123cb0b550d.zip |
Add block selection
This implements a block selection mode which can be triggered by holding
Control before starting a selection.
If text is copied using this block selection, newlines will be
automatically added to the end of the lines.
This fixes #526.
Diffstat (limited to 'alacritty_terminal/src/input.rs')
-rw-r--r-- | alacritty_terminal/src/input.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/alacritty_terminal/src/input.rs b/alacritty_terminal/src/input.rs index 17d427cd..b4ea5910 100644 --- a/alacritty_terminal/src/input.rs +++ b/alacritty_terminal/src/input.rs @@ -66,6 +66,7 @@ pub trait ActionContext { fn clear_selection(&mut self); fn update_selection(&mut self, point: Point, side: Side); fn simple_selection(&mut self, point: Point, side: Side); + fn block_selection(&mut self, point: Point, side: Side); fn semantic_selection(&mut self, point: Point); fn line_selection(&mut self, point: Point); fn selection_is_empty(&self) -> bool; @@ -612,7 +613,11 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { // Start new empty selection let side = self.ctx.mouse().cell_side; if let Some(point) = point { - self.ctx.simple_selection(point, side); + if modifiers.ctrl { + self.ctx.block_selection(point, side); + } else { + self.ctx.simple_selection(point, side); + } } let report_modes = @@ -991,6 +996,8 @@ mod tests { fn simple_selection(&mut self, _point: Point, _side: Side) {} + fn block_selection(&mut self, _point: Point, _side: Side) {} + fn copy_selection(&mut self, _: ClipboardType) {} fn clear_selection(&mut self) {} |