diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-11-01 13:20:38 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-11-01 13:53:32 -0400 |
commit | 96f9c0e249d6434606fa1613619b89dba03979ba (patch) | |
tree | d18a206ab63523d189db66f30fc0c0777f6fd3f9 | |
parent | 91726d4e0695ac4914885aada3304992e51bfb7f (diff) | |
download | vt100-rust-96f9c0e249d6434606fa1613619b89dba03979ba.tar.gz vt100-rust-96f9c0e249d6434606fa1613619b89dba03979ba.zip |
implement vt and ff
-rw-r--r-- | src/screen.rs | 10 | ||||
-rw-r--r-- | tests/control.rs | 22 |
2 files changed, 29 insertions, 3 deletions
diff --git a/src/screen.rs b/src/screen.rs index 96da40a..667a056 100644 --- a/src/screen.rs +++ b/src/screen.rs @@ -162,6 +162,14 @@ impl State { self.grid_mut().row_inc_scroll(1); } + fn vt(&mut self) { + self.lf(); + } + + fn ff(&mut self) { + self.lf(); + } + fn cr(&mut self) { self.grid_mut().col_set(0); } @@ -522,6 +530,8 @@ impl vte::Perform for State { 8 => self.bs(), 9 => self.tab(), 10 => self.lf(), + 11 => self.vt(), + 12 => self.ff(), 13 => self.cr(), _ => {} } diff --git a/tests/control.rs b/tests/control.rs index b9ae147..accc17e 100644 --- a/tests/control.rs +++ b/tests/control.rs @@ -60,11 +60,12 @@ fn tab() { ); } -#[test] -fn lf() { +fn lf_with(b: u8) { let mut screen = vt100::Screen::new(24, 80); - screen.process(b"foo\nbar"); + screen.process(b"foo"); + screen.process(&[b]); + screen.process(b"bar"); assert_eq!(screen.cell(0, 0).unwrap().contents(), "f"); assert_eq!(screen.cell(0, 1).unwrap().contents(), "o"); assert_eq!(screen.cell(0, 2).unwrap().contents(), "o"); @@ -83,6 +84,21 @@ fn lf() { } #[test] +fn lf() { + lf_with(b'\x0a'); +} + +#[test] +fn vt() { + lf_with(b'\x0b'); +} + +#[test] +fn ff() { + lf_with(b'\x0c'); +} + +#[test] fn cr() { let mut screen = vt100::Screen::new(24, 80); |