aboutsummaryrefslogtreecommitdiffstats
path: root/tests/window_contents.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2019-11-05 10:49:18 -0500
committerJesse Luehrs <doy@tozt.net>2019-11-05 10:51:02 -0500
commitb7359e5513e6102c293d51f0fbdabfccc3fe6450 (patch)
treeaf97d52da22a9061c7a7f26ebdbc4e01a3bc8fda /tests/window_contents.rs
parent665238f5318bee40f254fe43aa158e61bdd25392 (diff)
downloadvt100-rust-b7359e5513e6102c293d51f0fbdabfccc3fe6450.tar.gz
vt100-rust-b7359e5513e6102c293d51f0fbdabfccc3fe6450.zip
preserve the state of empty cells in contents_formatted
Diffstat (limited to 'tests/window_contents.rs')
-rw-r--r--tests/window_contents.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/window_contents.rs b/tests/window_contents.rs
index 5fe0cda..d79f75a 100644
--- a/tests/window_contents.rs
+++ b/tests/window_contents.rs
@@ -54,6 +54,18 @@ fn formatted() {
assert_eq!(parser.screen().contents_formatted(0, 0 ,23, 79), &b"foo\x1b[33;1;7mb\x1b[42;22ma\x1b[35mr\r\n\x1b[45mq\x1b[38;2;123;213;231mu\x1b[38;5;254mu\x1b[39mx"[..]);
}
+#[test]
+fn empty_cells() {
+ let mut parser = vt100::Parser::new(24, 80);
+ parser.process(b"\x1b[5C\x1b[32m bar\x1b[H\x1b[31mfoo");
+ compare_formatted(&parser);
+ assert_eq!(parser.screen().contents(0, 0, 23, 79), "foo bar");
+ assert_eq!(
+ parser.screen().contents_formatted(0, 0, 23, 79),
+ b"\x1b[31mfoo\x1b[m\x1b[C\x1b[C\x1b[32m bar"
+ );
+}
+
fn compare_formatted(parser: &vt100::Parser) {
let (rows, cols) = parser.screen().size();
let contents =