diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-12-14 02:54:40 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-12-14 03:29:06 -0500 |
commit | 6b647b9b46a76fb2dd4911e37981bc5b751d4e19 (patch) | |
tree | 6f683b1ad43c271705b20a9bde77cbc46f0a1e6e | |
parent | 7e7041f7fc1d9ff3577d44c9178181a70ee94463 (diff) | |
download | vt100-rust-6b647b9b46a76fb2dd4911e37981bc5b751d4e19.tar.gz vt100-rust-6b647b9b46a76fb2dd4911e37981bc5b751d4e19.zip |
be a bit more explicit
this was also true before, but it was extremely non-obvious, and it
should be more obvious
-rw-r--r-- | src/grid.rs | 11 |
1 files 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); |