diff options
author | Christian Duerr <contact@christianduerr.com> | 2020-07-27 19:05:25 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-27 22:05:25 +0300 |
commit | a7d5a965c54aab85ea7671b4622edd13262f60d7 (patch) | |
tree | 4a68a678fdceff19e5c0d2dd3d62c89b516d3d91 | |
parent | 86c978694ad2078a99a90f10cb12424f42a2b271 (diff) | |
download | alacritty-a7d5a965c54aab85ea7671b4622edd13262f60d7.tar.gz alacritty-a7d5a965c54aab85ea7671b4622edd13262f60d7.zip |
Fix scrolling with selection expansion
Fixes #4040.
-rw-r--r-- | alacritty/src/event.rs | 4 | ||||
-rw-r--r-- | alacritty/src/input.rs | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs index 84af666a..803e4398 100644 --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -167,7 +167,9 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon && self.terminal.selection.as_ref().map(|s| s.is_empty()) != Some(true) { self.update_selection(self.terminal.vi_mode_cursor.point, Side::Right); - } else if ElementState::Pressed == self.mouse().left_button_state { + } else if self.mouse().left_button_state == ElementState::Pressed + || self.mouse().right_button_state == ElementState::Pressed + { let (x, y) = (self.mouse().x, self.mouse().y); let size_info = self.size_info(); let point = size_info.pixels_to_coords(x, y); diff --git a/alacritty/src/input.rs b/alacritty/src/input.rs index 80f3e5d9..b6aca62b 100644 --- a/alacritty/src/input.rs +++ b/alacritty/src/input.rs @@ -366,7 +366,8 @@ impl<'a, T: EventListener, A: ActionContext<T>> Processor<'a, T, A> { let (x, y) = position.into(); let lmb_pressed = self.ctx.mouse().left_button_state == ElementState::Pressed; - if !self.ctx.selection_is_empty() && lmb_pressed && !search_active { + let rmb_pressed = self.ctx.mouse().right_button_state == ElementState::Pressed; + if !self.ctx.selection_is_empty() && (lmb_pressed || rmb_pressed) && !search_active { self.update_selection_scrolling(y); } @@ -405,7 +406,7 @@ 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().screen_lines() - 1; - if (lmb_pressed || self.ctx.mouse().right_button_state == ElementState::Pressed) + if (lmb_pressed || rmb_pressed) && (self.ctx.modifiers().shift() || !self.ctx.mouse_mode()) && !search_active { |