aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormahkoh <mahkoh@users.noreply.github.com>2022-04-16 20:39:26 +0200
committerGitHub <noreply@github.com>2022-04-16 18:39:26 +0000
commit9bbb296d1dc4f72e845695f22e903bcc1d66d5a3 (patch)
treedc3db86cb0747d7682299f11e567120b5f69e9a5
parentd5cad2a862467bf287b20d7a471801ab2219456a (diff)
downloadalacritty-9bbb296d1dc4f72e845695f22e903bcc1d66d5a3.tar.gz
alacritty-9bbb296d1dc4f72e845695f22e903bcc1d66d5a3.zip
Fix selection copy without button release
To prevent the current selection clipboard from being overwritten right before pasting, text is no longer copied solely because the user scrolled the scrollback buffer. The selection also isn't copied when a mouse button other than LMB/RMB are released, since these are the only ones capable of modifying the selection range. This should prevent issues where the selection of the user gets unexpectedly overwritten, especially in scenarios where the user is currently in the process of pasting something into Alacritty. Signed-off-by: Julian Orth <ju.orth@gmail.com>
-rw-r--r--CHANGELOG.md1
-rw-r--r--alacritty/src/event.rs1
-rw-r--r--alacritty/src/input.rs6
3 files changed, 5 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c43909c7..4439f9ac 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -33,6 +33,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Failure when running on 10-bit color system
- The colors being slightly different when using srgb displays on macOS
- Vi cursor blinking not reset when navigating in search
+- Scrolling and middle-clicking modifying the primary selection
## 0.10.1
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs
index d32fd6e5..1db6e450 100644
--- a/alacritty/src/event.rs
+++ b/alacritty/src/event.rs
@@ -233,7 +233,6 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon
let point = self.mouse.point(&self.size_info(), display_offset);
self.update_selection(point, self.mouse.cell_side);
}
- self.copy_selection(ClipboardType::Selection);
*self.dirty = true;
}
diff --git a/alacritty/src/input.rs b/alacritty/src/input.rs
index 16649327..0f389851 100644
--- a/alacritty/src/input.rs
+++ b/alacritty/src/input.rs
@@ -614,8 +614,10 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> {
let timer_id = TimerId::new(Topic::SelectionScrolling, self.ctx.window().id());
self.ctx.scheduler_mut().unschedule(timer_id);
- // Copy selection on release, to prevent flooding the display server.
- self.ctx.copy_selection(ClipboardType::Selection);
+ if let MouseButton::Left | MouseButton::Right = button {
+ // Copy selection on release, to prevent flooding the display server.
+ self.ctx.copy_selection(ClipboardType::Selection);
+ }
}
pub fn mouse_wheel_input(&mut self, delta: MouseScrollDelta, phase: TouchPhase) {