summaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/ansi.rs
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2019-11-11 01:12:14 +0100
committerGitHub <noreply@github.com>2019-11-11 01:12:14 +0100
commite8ca1ef7d988de9909a375680b1e081cae926341 (patch)
tree7c033d170540b125e5a9cc59c693cc7e7d281075 /alacritty_terminal/src/ansi.rs
parent0ac3481f8349247fb6368ba730506cc657d559fe (diff)
downloadalacritty-e8ca1ef7d988de9909a375680b1e081cae926341.tar.gz
alacritty-e8ca1ef7d988de9909a375680b1e081cae926341.zip
Add escape for reading clipboard
Diffstat (limited to 'alacritty_terminal/src/ansi.rs')
-rw-r--r--alacritty_terminal/src/ansi.rs18
1 files changed, 7 insertions, 11 deletions
diff --git a/alacritty_terminal/src/ansi.rs b/alacritty_terminal/src/ansi.rs
index 55c064e1..3cd03cbb 100644
--- a/alacritty_terminal/src/ansi.rs
+++ b/alacritty_terminal/src/ansi.rs
@@ -16,7 +16,6 @@
use std::io;
use std::str;
-use base64;
use log::{debug, trace};
use serde::{Deserialize, Serialize};
@@ -324,7 +323,10 @@ pub trait Handler {
fn reset_color(&mut self, _: usize) {}
/// Set the clipboard
- fn set_clipboard(&mut self, _: &str) {}
+ fn set_clipboard(&mut self, _: u8, _: &[u8]) {}
+
+ /// Write clipboard data to child.
+ fn write_clipboard<W: io::Write>(&mut self, _: u8, _: &mut W) {}
/// Run the dectest routine
fn dectest(&mut self) {}
@@ -847,19 +849,13 @@ where
// Set clipboard
b"52" => {
- if params.len() < 3 {
+ if params.len() < 3 || params[1].is_empty() {
return unhandled(params);
}
match params[2] {
- b"?" => unhandled(params),
- selection => {
- if let Ok(string) = base64::decode(selection) {
- if let Ok(utf8_string) = str::from_utf8(&string) {
- self.handler.set_clipboard(utf8_string);
- }
- }
- },
+ b"?" => self.handler.write_clipboard(params[1][0], writer),
+ base64 => self.handler.set_clipboard(params[1][0], base64),
}
},