diff options
author | Stefan Devai <stedevai@protonmail.com> | 2020-03-19 13:39:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-19 15:39:00 +0300 |
commit | 3d7a789fd344370d18a3da0d1f799959e51f8229 (patch) | |
tree | 7ece8aa46da88fcf5a232bb1f9dd02a647f692c6 | |
parent | 01e603519a4e72c49f16a44ccee97d2483dbcaf2 (diff) | |
download | alacritty-3d7a789fd344370d18a3da0d1f799959e51f8229.tar.gz alacritty-3d7a789fd344370d18a3da0d1f799959e51f8229.zip |
Remove right click deselection
Fixes #3144.
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | alacritty/src/input.rs | 33 |
2 files changed, 20 insertions, 14 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index be8b62f3..6d6550bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Block cursor is no longer inverted at the start/end of a selection +- Preserve selection on non-LMB or mouse mode clicks ## 0.4.2-dev diff --git a/alacritty/src/input.rs b/alacritty/src/input.rs index b9210393..6a2d925b 100644 --- a/alacritty/src/input.rs +++ b/alacritty/src/input.rs @@ -504,23 +504,28 @@ impl<'a, T: EventListener, A: ActionContext<T>> Processor<'a, T, A> { ClickState::TripleClick } _ => { - // Don't launch URLs if this click cleared the selection - self.ctx.mouse_mut().block_url_launcher = !self.ctx.selection_is_empty(); + if button == MouseButton::Left + && (self.ctx.modifiers().shift() + || !self.ctx.terminal().mode().intersects(TermMode::MOUSE_MODE)) + { + // Don't launch URLs if this click cleared the selection + self.ctx.mouse_mut().block_url_launcher = !self.ctx.selection_is_empty(); - self.ctx.clear_selection(); + self.ctx.clear_selection(); - // Start new empty selection - let side = self.ctx.mouse().cell_side; - if self.ctx.modifiers().ctrl() { - self.ctx.start_selection(SelectionType::Block, point, side); - } else { - self.ctx.start_selection(SelectionType::Simple, point, side); - } + // Start new empty selection + let side = self.ctx.mouse().cell_side; + if self.ctx.modifiers().ctrl() { + self.ctx.start_selection(SelectionType::Block, point, side); + } else { + self.ctx.start_selection(SelectionType::Simple, point, side); + } - // Move vi mode cursor to mouse 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; + // Move vi mode cursor to mouse 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; + } } if !self.ctx.modifiers().shift() && self.ctx.mouse_mode() { |