aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-12-13 23:16:22 -0500
committerJesse Luehrs <doy@tozt.net>2021-12-13 23:22:12 -0500
commit3bbf036e01b9c8314c1d52ea38dfa6e5a7cc9e3d (patch)
tree027d042f98cba7ff499147807144c16b28200d11
parentf60e21ec187fc1357f78b2e91999d28fbca6d2e1 (diff)
downloadvt100-rust-3bbf036e01b9c8314c1d52ea38dfa6e5a7cc9e3d.tar.gz
vt100-rust-3bbf036e01b9c8314c1d52ea38dfa6e5a7cc9e3d.zip
fix restoring the cursor position when scrolled back
-rw-r--r--CHANGELOG.md1
-rw-r--r--src/grid.rs10
2 files changed, 6 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e2c7a96..0fe048b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@
* No longer generate spurious diffs in some cases where the cursor is past the
end of a row
+* Fix restoring the cursor position when scrolled back
## [0.14.0] - 2021-12-06
diff --git a/src/grid.rs b/src/grid.rs
index a36491b..bde6726 100644
--- a/src/grid.rs
+++ b/src/grid.rs
@@ -298,10 +298,10 @@ impl Grid {
row: self.pos.row,
col: self.size.cols - 1,
};
- if self.visible_cell(pos).unwrap().is_wide_continuation() {
+ if self.drawing_cell(pos).unwrap().is_wide_continuation() {
pos.col = self.size.cols - 2;
}
- let cell = self.visible_cell(pos).unwrap();
+ let cell = self.drawing_cell(pos).unwrap();
if cell.has_contents() {
if let Some(prev_pos) = prev_pos {
crate::term::MoveFromTo::new(prev_pos, pos)
@@ -326,11 +326,11 @@ impl Grid {
for i in (0..orig_row).rev() {
pos.row = i;
pos.col = self.size.cols - 1;
- if self.visible_cell(pos).unwrap().is_wide_continuation()
+ if self.drawing_cell(pos).unwrap().is_wide_continuation()
{
pos.col = self.size.cols - 2;
}
- let cell = self.visible_cell(pos).unwrap();
+ let cell = self.drawing_cell(pos).unwrap();
if cell.has_contents() {
// not sure why this is triggering here, seems like a
// clippy bug
@@ -388,7 +388,7 @@ impl Grid {
contents.push(b' ');
// we know that the cell has no contents, but it still may
// have drawing attributes (background color, etc)
- let end_cell = self.visible_cell(pos).unwrap();
+ let end_cell = self.drawing_cell(pos).unwrap();
end_cell
.attrs()
.write_escape_code_diff(contents, &prev_attrs);