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>
This commit is contained in:
mahkoh 2022-04-16 20:39:26 +02:00 committed by GitHub
parent d5cad2a862
commit 9bbb296d1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 deletions

View file

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

View file

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

View file

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