diff options
author | Christian Duerr <contact@christianduerr.com> | 2020-07-27 19:05:25 +0000 |
---|---|---|
committer | Christian Duerr <contact@christianduerr.com> | 2020-07-27 21:11:57 +0000 |
commit | 313aa5cd185dbd31aba752c71a5e88893fe3d9af (patch) | |
tree | 9cf13aaf71feda61f76595acbd8a7d662ca3b14b | |
parent | a4c763e78a725fee56671fa906a539e5f988666e (diff) | |
download | alacritty-313aa5cd185dbd31aba752c71a5e88893fe3d9af.tar.gz alacritty-313aa5cd185dbd31aba752c71a5e88893fe3d9af.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 { |