From f0775b3c89e92b92b74d5c9138a9770af80f589f Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Wed, 24 Jun 2020 08:29:07 +0000 Subject: 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. --- alacritty/src/input.rs | 12 +++++++++--- 1 file 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> 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> 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> 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; } } -- cgit v1.2.3-54-g00ecf