Fix scrolling with selection expansion

Fixes #4040.
This commit is contained in:
Christian Duerr 2020-07-27 19:05:25 +00:00 committed by GitHub
parent 86c978694a
commit a7d5a965c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -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);

View File

@ -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
{