diff options
author | Joe Wilm <joe@jwilm.com> | 2017-06-15 21:43:28 -0700 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2017-06-19 21:31:50 -0700 |
commit | 63bcb4601198790ccdb96ffec4a360ce3080e685 (patch) | |
tree | c2fb6452215559082df60a46c40473bbd5353c9c /src/input.rs | |
parent | 3dfac443c7779646c96cadb06913518c458b0eb8 (diff) | |
download | alacritty-63bcb4601198790ccdb96ffec4a360ce3080e685.tar.gz alacritty-63bcb4601198790ccdb96ffec4a360ce3080e685.zip |
Implement semantic and line selection dragging
Unlike the regular selection that is by cell, these selection modes
highlight either semantic groupings or entire lines while the mouse is
dragged.
Diffstat (limited to 'src/input.rs')
-rw-r--r-- | src/input.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/input.rs b/src/input.rs index de8bca45..920e55f5 100644 --- a/src/input.rs +++ b/src/input.rs @@ -54,9 +54,10 @@ pub trait ActionContext { fn size_info(&self) -> SizeInfo; fn copy_selection(&self, Buffer); fn clear_selection(&mut self); - fn update_selection(&mut self, Point, Side); - fn semantic_selection(&mut self, Point); - fn line_selection(&mut self, Point); + fn update_selection(&mut self, point: Point, side: Side); + fn simple_selection(&mut self, point: Point, side: Side); + fn semantic_selection(&mut self, point: Point); + fn line_selection(&mut self, point: Point); fn mouse_mut(&mut self) -> &mut Mouse; fn mouse_coords(&self) -> Option<Point>; } @@ -494,7 +495,6 @@ mod tests { use term::{SizeInfo, Term, TermMode, mode}; use event::{Mouse, ClickState}; use config::{self, Config, ClickHandler}; - use selection::Selection; use index::{Point, Side}; use super::{Action, Binding, Processor}; @@ -510,7 +510,7 @@ mod tests { struct ActionContext<'a> { pub terminal: &'a mut Term, - pub selection: &'a mut Selection, + pub selection: Option<&'a mut Selection>, pub size_info: &'a SizeInfo, pub mouse: &'a mut Mouse, pub last_action: MultiClick, @@ -578,15 +578,16 @@ mod tests { padding_y: 0.0, }; + use ::ansi::TermInfo; + let mut terminal = Term::new(&config, size); let mut mouse = Mouse::default(); - let mut selection = Selection::new(); mouse.click_state = $initial_state; let context = ActionContext { terminal: &mut terminal, - selection: &mut selection, + selection: None, mouse: &mut mouse, size_info: &size, last_action: MultiClick::None, |