diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-11-08 03:35:44 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-11-08 03:38:00 -0500 |
commit | ac6aa6cb1659dd716701e2af41756ed3fe5faf0d (patch) | |
tree | 421d104e9590e846c8990b6ff5777f9dd59b82cf /src/row.rs | |
parent | 484e4439a7984dd55d46eb432f5b7822b12b2c4a (diff) | |
download | vt100-rust-ac6aa6cb1659dd716701e2af41756ed3fe5faf0d.tar.gz vt100-rust-ac6aa6cb1659dd716701e2af41756ed3fe5faf0d.zip |
clearing cells sets the background color
Diffstat (limited to 'src/row.rs')
-rw-r--r-- | src/row.rs | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -14,9 +14,9 @@ impl Row { } } - pub fn clear(&mut self) { + pub fn clear(&mut self, bgcolor: crate::attrs::Color) { for cell in &mut self.cells { - cell.clear(); + cell.clear(bgcolor); } self.wrapped = false; } @@ -113,8 +113,10 @@ impl Row { contents.extend(if cell.has_contents() { cell.contents().as_bytes() + } else if cell.bgcolor() == crate::attrs::Color::Default { + &b"\x1b[C"[..] } else { - b"\x1b[C" + &b"\x1b[X\x1b[C"[..] }); prev_was_wide = cell.is_wide(); @@ -172,7 +174,9 @@ impl Row { for (col, cell) in self.cells.iter().skip(start as usize).enumerate().rev() { - if cell.has_contents() { + if cell.has_contents() + || cell.bgcolor() != crate::attrs::Color::Default + { let width: u16 = col.try_into().unwrap(); return width + 1; } |