summaryrefslogtreecommitdiff
path: root/src/ansi.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/ansi.rs')
-rw-r--r--src/ansi.rs23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/ansi.rs b/src/ansi.rs
index 3d66b497..8ff7d06b 100644
--- a/src/ansi.rs
+++ b/src/ansi.rs
@@ -18,7 +18,7 @@ use std::ops::Range;
use std::str;
use vte;
-
+use base64;
use index::{Column, Line, Contains};
use ::{MouseCursor, Rgb};
@@ -342,6 +342,9 @@ pub trait Handler {
/// Reset an indexed color to original value
fn reset_color(&mut self, usize) {}
+ /// Set the clipboard
+ fn set_clipboard(&mut self, &str) {}
+
/// Run the dectest routine
fn dectest(&mut self) {}
}
@@ -820,6 +823,24 @@ impl<'a, H, W> vte::Perform for Performer<'a, H, W>
}
}
+ // Set clipboard
+ b"52" => {
+ if params.len() < 3 {
+ return unhandled!();
+ }
+
+ match params[2] {
+ b"?" => unhandled!(),
+ selection => {
+ if let Ok(string) = base64::decode(selection) {
+ if let Ok(utf8_string) = str::from_utf8(&string) {
+ self.handler.set_clipboard(utf8_string);
+ }
+ }
+ }
+ }
+ }
+
// Reset color index
b"104" => {
// Reset all color indexes when no parameters are given