aboutsummaryrefslogtreecommitdiffstats
path: root/src/cell.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2019-11-11 11:48:38 -0500
committerJesse Luehrs <doy@tozt.net>2019-11-11 11:48:38 -0500
commit346c7404ecc51556f86efd3222c86148101c89a0 (patch)
treed8c015228f7e08eef31a6edfb60857eb54d76d56 /src/cell.rs
parentede7fdaf5ce7868b42d19d5f5916935a46d13dd6 (diff)
downloadvt100-rust-346c7404ecc51556f86efd3222c86148101c89a0.tar.gz
vt100-rust-346c7404ecc51556f86efd3222c86148101c89a0.zip
preserve all text attributes on cleared cells
some terminals require it (alacritty wants to render underline and inverse state of cleared cells, for instance, so we have to be sure that the diff algorithm will properly reset the cursor attributes before clearing cells)
Diffstat (limited to 'src/cell.rs')
-rw-r--r--src/cell.rs17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/cell.rs b/src/cell.rs
index 4f26cb5..05d93be 100644
--- a/src/cell.rs
+++ b/src/cell.rs
@@ -17,16 +17,10 @@ impl PartialEq<Cell> for Cell {
if self.len != other.len {
return false;
}
- let len = self.len();
- if len > 0 {
- if self.attrs != other.attrs {
- return false;
- }
- } else {
- if self.attrs.bgcolor != other.attrs.bgcolor {
- return false;
- }
+ if self.attrs != other.attrs {
+ return false;
}
+ let len = self.len();
self.contents[..len] == other.contents[..len]
}
}
@@ -83,10 +77,9 @@ impl Cell {
self.set_wide(new_contents[0].width().unwrap_or(0) > 1);
}
- pub(crate) fn clear(&mut self, bgcolor: crate::attrs::Color) {
+ pub(crate) fn clear(&mut self, attrs: crate::attrs::Attrs) {
self.len = 0;
- self.attrs.clear();
- self.attrs.bgcolor = bgcolor;
+ self.attrs = attrs;
}
/// Returns the text contents of the cell.