aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/event.rs
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2021-04-17 19:28:23 +0000
committerGitHub <noreply@github.com>2021-04-17 19:28:23 +0000
commita312e415951fcb9156572f124b42f68c09f60ae9 (patch)
tree55f5a931fb8b720783bad5159b0a0ec175106270 /alacritty/src/event.rs
parent33d4b833dca46b775f485d0547f9f8804849fe8a (diff)
downloadr-alacritty-a312e415951fcb9156572f124b42f68c09f60ae9.tar.gz
r-alacritty-a312e415951fcb9156572f124b42f68c09f60ae9.tar.bz2
r-alacritty-a312e415951fcb9156572f124b42f68c09f60ae9.zip
Fix selection flooding Wayland connection
This resolves an issue where an excessive clipboard update frequency would cause the Wayland display server to ignore necessary selection updates. Instead of copying the selection to the clipboard during the selection process, it is now only copied once the mouse button is released. Fixes #4953.
Diffstat (limited to 'alacritty/src/event.rs')
-rw-r--r--alacritty/src/event.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs
index e61354b8..612a0cc0 100644
--- a/alacritty/src/event.rs
+++ b/alacritty/src/event.rs
@@ -206,7 +206,7 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon
// Update selection.
if self.terminal.mode().contains(TermMode::VI)
- && self.terminal.selection.as_ref().map(|s| s.is_empty()) != Some(true)
+ && self.terminal.selection.as_ref().map_or(true, |s| !s.is_empty())
{
self.update_selection(self.terminal.vi_mode_cursor.point, Side::Right);
} else if self.mouse.left_button_state == ElementState::Pressed
@@ -216,6 +216,7 @@ 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;
}
@@ -262,8 +263,6 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon
self.terminal.selection = Some(selection);
*self.dirty = true;
-
- self.copy_selection(ClipboardType::Selection);
}
fn start_selection(&mut self, ty: SelectionType, point: Point, side: Side) {
@@ -461,6 +460,7 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon
let end = *focused_match.end();
self.start_selection(SelectionType::Simple, start, Side::Left);
self.update_selection(end, Side::Right);
+ self.copy_selection(ClipboardType::Selection);
}
self.search_state.dfas = None;
@@ -656,6 +656,7 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon
HintAction::Action(HintInternalAction::Select) => {
self.start_selection(SelectionType::Simple, *hint.bounds.start(), Side::Left);
self.update_selection(*hint.bounds.end(), Side::Right);
+ self.copy_selection(ClipboardType::Selection);
},
// Move the vi mode cursor.
HintAction::Action(HintInternalAction::MoveViModeCursor) => {