aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-12-10 04:23:21 -0500
committerJesse Luehrs <doy@tozt.net>2021-12-10 04:23:21 -0500
commitf60e21ec187fc1357f78b2e91999d28fbca6d2e1 (patch)
treecf9b06001e37ef0a9b7a7e3bcbac0ffc31743929 /src
parentd6e3c3c07140c8fbb69ad4cc3b4369456458c613 (diff)
downloadvt100-rust-f60e21ec187fc1357f78b2e91999d28fbca6d2e1.tar.gz
vt100-rust-f60e21ec187fc1357f78b2e91999d28fbca6d2e1.zip
ensure that diffing a screen against itself always returns nothing
Diffstat (limited to 'src')
-rw-r--r--src/grid.rs3
-rw-r--r--src/row.rs2
-rw-r--r--src/screen.rs1
3 files changed, 6 insertions, 0 deletions
diff --git a/src/grid.rs b/src/grid.rs
index 9681638..a36491b 100644
--- a/src/grid.rs
+++ b/src/grid.rs
@@ -250,6 +250,7 @@ impl Grid {
) -> crate::attrs::Attrs {
let mut prev_pos = prev.pos;
let mut wrapping = false;
+ let mut prev_wrapping = false;
for (i, (row, prev_row)) in
self.visible_rows().zip(prev.visible_rows()).enumerate()
{
@@ -261,12 +262,14 @@ impl Grid {
self.size.cols,
i,
wrapping,
+ prev_wrapping,
prev_pos,
prev_attrs,
);
prev_pos = new_pos;
prev_attrs = new_attrs;
wrapping = row.wrapped();
+ prev_wrapping = prev_row.wrapped();
}
self.write_cursor_position_formatted(
diff --git a/src/row.rs b/src/row.rs
index f1c3086..d60d48b 100644
--- a/src/row.rs
+++ b/src/row.rs
@@ -286,6 +286,7 @@ impl Row {
width: u16,
row: u16,
wrapping: bool,
+ prev_wrapping: bool,
mut prev_pos: crate::grid::Pos,
mut prev_attrs: crate::attrs::Attrs,
) -> (crate::grid::Pos, crate::attrs::Attrs) {
@@ -294,6 +295,7 @@ impl Row {
let first_cell = self.get(start).unwrap();
let prev_first_cell = prev.get(start).unwrap();
if wrapping
+ && !prev_wrapping
&& first_cell == prev_first_cell
&& prev_pos.row + 1 == row
&& prev_pos.col
diff --git a/src/screen.rs b/src/screen.rs
index cec1888..c885242 100644
--- a/src/screen.rs
+++ b/src/screen.rs
@@ -368,6 +368,7 @@ impl Screen {
width,
i,
false,
+ false,
crate::grid::Pos { row: i, col: start },
crate::attrs::Attrs::default(),
);