From b7359e5513e6102c293d51f0fbdabfccc3fe6450 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 5 Nov 2019 10:49:18 -0500 Subject: preserve the state of empty cells in contents_formatted --- tests/window_contents.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/window_contents.rs') 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 = -- cgit v1.2.3-54-g00ecf