diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-10-30 04:27:55 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-10-30 04:33:22 -0400 |
commit | cd1b954dadf23a6278a92676b6911efad84b4f19 (patch) | |
tree | d5075789a297bcbd981bf2a9c14e516160c2023c | |
parent | 09f7e56a9f0667ef551185ebaa89f55d8ded119a (diff) | |
download | vt100-rust-cd1b954dadf23a6278a92676b6911efad84b4f19.tar.gz vt100-rust-cd1b954dadf23a6278a92676b6911efad84b4f19.zip |
more passing tests
-rw-r--r-- | src/screen.rs | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/screen.rs b/src/screen.rs index 9fc1671..609bbf2 100644 --- a/src/screen.rs +++ b/src/screen.rs @@ -346,6 +346,23 @@ impl State { } // osc codes + + fn osc0(&mut self, s: &[u8]) { + self.osc1(s); + self.osc2(s); + } + + fn osc1(&mut self, s: &[u8]) { + if let Some(s) = std::str::from_utf8(s).ok() { + self.icon_name = Some(s.to_string()) + } + } + + fn osc2(&mut self, s: &[u8]) { + if let Some(s) = std::str::from_utf8(s).ok() { + self.title = Some(s.to_string()) + } + } } impl vte::Perform for State { @@ -412,7 +429,14 @@ impl vte::Perform for State { } } - fn osc_dispatch(&mut self, _params: &[&[u8]]) {} + fn osc_dispatch(&mut self, params: &[&[u8]]) { + match params[0] { + b"0" => self.osc0(params[1]), + b"1" => self.osc1(params[1]), + b"2" => self.osc2(params[1]), + _ => {} + } + } // don't care fn hook(&mut self, _: &[i64], _: &[u8], _: bool) {} |