From 6b647b9b46a76fb2dd4911e37981bc5b751d4e19 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 14 Dec 2021 02:54:40 -0500 Subject: be a bit more explicit this was also true before, but it was extremely non-obvious, and it should be more obvious --- src/grid.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/grid.rs b/src/grid.rs index 2f6a25c..de98da1 100644 --- a/src/grid.rs +++ b/src/grid.rs @@ -322,9 +322,8 @@ impl Grid { // earlier row, we can just write a few newlines, otherwise we // also need to do the same as above to get ourselves to after // the end of a row. - let orig_row = pos.row; let mut found = false; - for i in (0..orig_row).rev() { + for i in (0..self.pos.row).rev() { pos.row = i; pos.col = self.size.cols - 1; if self.drawing_cell(pos).unwrap().is_wide_continuation() @@ -362,7 +361,8 @@ impl Grid { ); } contents.extend( - "\n".repeat((orig_row - i) as usize).as_bytes(), + "\n".repeat((self.pos.row - i) as usize) + .as_bytes(), ); found = true; break; @@ -376,7 +376,10 @@ impl Grid { // would have caught that above, so it should be safe to // overwrite it. if !found { - pos.row = orig_row; + pos = Pos { + row: self.pos.row, + col: self.size.cols - 1, + }; if let Some(prev_pos) = prev_pos { crate::term::MoveFromTo::new(prev_pos, pos) .write_buf(contents); -- cgit v1.2.3-54-g00ecf