From 3bbf036e01b9c8314c1d52ea38dfa6e5a7cc9e3d Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 13 Dec 2021 23:16:22 -0500 Subject: fix restoring the cursor position when scrolled back --- CHANGELOG.md | 1 + src/grid.rs | 10 +++++----- 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); -- cgit v1.2.3-54-g00ecf