aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/input.rs
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 /alacritty/src/input.rs
parentd5cad2a862467bf287b20d7a471801ab2219456a (diff)
downloadr-alacritty-9bbb296d1dc4f72e845695f22e903bcc1d66d5a3.tar.gz
r-alacritty-9bbb296d1dc4f72e845695f22e903bcc1d66d5a3.tar.bz2
r-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>
Diffstat (limited to 'alacritty/src/input.rs')
-rw-r--r--alacritty/src/input.rs6
1 files changed, 4 insertions, 2 deletions
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) {