summaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/event.rs
diff options
context:
space:
mode:
authorChristian Duerr <chrisduerr@users.noreply.github.com>2019-04-28 20:21:39 +0000
committerGitHub <noreply@github.com>2019-04-28 20:21:39 +0000
commit9e89aaa477369b20a06f4b9f636d7fd543c4c985 (patch)
tree81deb1b250541a3c8fe7b6f9274f5a87f265a314 /alacritty_terminal/src/event.rs
parent37b66a7cd2e53fae93e3c2c8bc3ddbd9cbe140d2 (diff)
downloadalacritty-9e89aaa477369b20a06f4b9f636d7fd543c4c985.tar.gz
alacritty-9e89aaa477369b20a06f4b9f636d7fd543c4c985.zip
Switch from copypasta to rust-clipboard
This switches our own `copypasta` crate with the more standardized `clipboard` library, which allows us to get rid of the `xclip` dependency on X11. Additionally, this lays the foundation for native Wayland clipboard support once the clipboard crate is updated (or a fork is created). Fixes #5.
Diffstat (limited to 'alacritty_terminal/src/event.rs')
-rw-r--r--alacritty_terminal/src/event.rs11
1 files changed, 3 insertions, 8 deletions
diff --git a/alacritty_terminal/src/event.rs b/alacritty_terminal/src/event.rs
index 1f3e9ca5..f27a6caa 100644
--- a/alacritty_terminal/src/event.rs
+++ b/alacritty_terminal/src/event.rs
@@ -8,13 +8,13 @@ use std::io::Write;
use std::sync::mpsc;
use std::time::Instant;
-use copypasta::{Buffer as ClipboardBuffer, Clipboard, Load, Store};
use glutin::dpi::PhysicalSize;
use glutin::{self, ElementState, Event, ModifiersState, MouseButton};
use parking_lot::MutexGuard;
use serde_json as json;
use crate::cli::Options;
+use crate::clipboard::ClipboardType;
use crate::config::{self, Config};
use crate::display::OnResize;
use crate::grid::Scroll;
@@ -26,7 +26,6 @@ use crate::term::cell::Cell;
use crate::term::{SizeInfo, Term};
#[cfg(unix)]
use crate::tty;
-use crate::util::fmt::Red;
use crate::util::{limit, start_daemon};
use crate::window::Window;
@@ -70,14 +69,10 @@ impl<'a, N: Notify + 'a> input::ActionContext for ActionContext<'a, N> {
}
}
- fn copy_selection(&self, buffer: ClipboardBuffer) {
+ fn copy_selection(&mut self, ty: ClipboardType) {
if let Some(selected) = self.terminal.selection_to_string() {
if !selected.is_empty() {
- Clipboard::new()
- .and_then(|mut clipboard| clipboard.store(selected, buffer))
- .unwrap_or_else(|err| {
- warn!("Error storing selection to clipboard. {}", Red(err));
- });
+ self.terminal.clipboard().store(ty, selected);
}
}
}