aboutsummaryrefslogtreecommitdiffstats
path: root/src/row.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/row.rs')
-rw-r--r--src/row.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/row.rs b/src/row.rs
index 7b2ab99..b563b33 100644
--- a/src/row.rs
+++ b/src/row.rs
@@ -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;
}