summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alacritty/src/event.rs7
-rw-r--r--alacritty/src/input.rs3
2 files changed, 7 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) => {
diff --git a/alacritty/src/input.rs b/alacritty/src/input.rs
index 977a6e5d..3559b85e 100644
--- a/alacritty/src/input.rs
+++ b/alacritty/src/input.rs
@@ -634,6 +634,9 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> {
self.ctx.display().highlighted_hint = hint;
self.ctx.scheduler_mut().unschedule(TimerId::SelectionScrolling);
+
+ // 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) {