diff options
author | Joe Wilm <joe@jwilm.com> | 2016-12-26 22:52:37 -0500 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2016-12-26 22:56:19 -0500 |
commit | ae470bf68bf27921109890da3d90a5b61fa6a7aa (patch) | |
tree | d9e3d3a90f29471a0fe68a0e3966d95deb3a6f39 /src/input.rs | |
parent | d28a7344731c4cd913687a893334555feed4e270 (diff) | |
download | alacritty-ae470bf68bf27921109890da3d90a5b61fa6a7aa.tar.gz alacritty-ae470bf68bf27921109890da3d90a5b61fa6a7aa.zip |
Implement copying selection for macOS
Still need automatic loading into selection copy buffer for linux.
Diffstat (limited to 'src/input.rs')
-rw-r--r-- | src/input.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/input.rs b/src/input.rs index 92379be9..4339b69f 100644 --- a/src/input.rs +++ b/src/input.rs @@ -148,8 +148,14 @@ impl Action { ctx.notifier.notify(s.clone().into_bytes()) }, Action::Copy => { - // so... need access to terminal state. and the selection. - unimplemented!(); + if let Some(selection) = ctx.selection.span() { + let buf = ctx.terminal.string_from_selection(&selection); + + Clipboard::new() + .expect("get clipboard") + .store_primary(buf) + .expect("copy into clipboard"); + } }, Action::Paste | Action::PasteSelection => { @@ -328,6 +334,7 @@ impl<'a, N: Notify + 'a> Processor<'a, N> { // Didn't process a binding; print the provided character if let Some(string) = string { self.ctx.notifier.notify(string.into_bytes()); + self.ctx.selection.clear(); } } } |