diff options
author | Christian Duerr <contact@christianduerr.com> | 2020-06-24 08:29:07 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-24 08:29:07 +0000 |
commit | f0775b3c89e92b92b74d5c9138a9770af80f589f (patch) | |
tree | 3c0b2a295df8020361553229357ad9b090761abe | |
parent | 5eb0792c9060e47404550d59d31fd1876f248202 (diff) | |
download | alacritty-f0775b3c89e92b92b74d5c9138a9770af80f589f.tar.gz alacritty-f0775b3c89e92b92b74d5c9138a9770af80f589f.zip |
Fix live right-click expansion
While the commit 43c0ad6ea9d2467ccf867a310c4f1e30f5b627c6 introduced
right click as a way to expand the active selection, it did not allow
for holding right click to continuously do so.
This commit remedies that problem by allowing live expansion with while
holding the right mouse button.
-rw-r--r-- | alacritty/src/input.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/alacritty/src/input.rs b/alacritty/src/input.rs index b0a6eb80..2819c850 100644 --- a/alacritty/src/input.rs +++ b/alacritty/src/input.rs @@ -361,7 +361,9 @@ impl<'a, T: EventListener, A: ActionContext<T>> Processor<'a, T, A> { self.ctx.window_mut().set_mouse_cursor(mouse_state.into()); let last_term_line = self.ctx.terminal().grid().num_lines() - 1; - if lmb_pressed && (self.ctx.modifiers().shift() || !self.ctx.mouse_mode()) { + if (lmb_pressed || self.ctx.mouse().right_button_state == ElementState::Pressed) + && (self.ctx.modifiers().shift() || !self.ctx.mouse_mode()) + { // Treat motion over message bar like motion over the last line. let line = min(point.line, last_term_line); @@ -558,6 +560,11 @@ impl<'a, T: EventListener, A: ActionContext<T>> Processor<'a, T, A> { selection.ty = selection_type; self.ctx.update_selection(point, cell_side); + + // Move vi mode cursor to mouse click position. + if self.ctx.terminal().mode().contains(TermMode::VI) { + self.ctx.terminal_mut().vi_mode_cursor.point = point; + } } /// Handle left click selection and vi mode cursor movement. @@ -589,9 +596,8 @@ impl<'a, T: EventListener, A: ActionContext<T>> Processor<'a, T, A> { ClickState::None => (), }; - // Move vi mode cursor to mouse position. + // Move vi mode cursor to mouse click position. if self.ctx.terminal().mode().contains(TermMode::VI) { - // Update Vi mode cursor position on click. self.ctx.terminal_mut().vi_mode_cursor.point = point; } } |