aboutsummaryrefslogtreecommitdiffstats
path: root/src/screen.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-12-14 03:19:49 -0500
committerJesse Luehrs <doy@tozt.net>2021-12-14 03:29:06 -0500
commit160942c40cbeb7503147c0895217644161fcc84b (patch)
tree87592d28566aacdc2179a8bd27db63303e055a77 /src/screen.rs
parent7c5809e747b52b6d0f1c207e2e138618b075457e (diff)
downloadvt100-rust-160942c40cbeb7503147c0895217644161fcc84b.tar.gz
vt100-rust-160942c40cbeb7503147c0895217644161fcc84b.zip
remove current_cell/current_cell_mut
it had an unstated precondition that the cursor was not positioned off the end of a row, which happened to be true in all existing uses, but was hard to verify. moving the unwrap out to the call site makes it easier to audit each use.
Diffstat (limited to 'src/screen.rs')
-rw-r--r--src/screen.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/screen.rs b/src/screen.rs
index 6c3d629..9e81ee2 100644
--- a/src/screen.rs
+++ b/src/screen.rs
@@ -906,12 +906,12 @@ impl Screen {
next_cell.set(' ', attrs);
}
- let cell = self.grid_mut().current_cell_mut();
+ let cell = self.grid_mut().drawing_cell_mut(pos).unwrap();
cell.set(c, attrs);
self.grid_mut().col_inc(1);
if width > 1 {
let pos = self.grid().pos();
- if self.grid().current_cell().is_wide() {
+ if self.grid().drawing_cell(pos).unwrap().is_wide() {
let next_next_pos = crate::grid::Pos {
row: pos.row,
col: pos.col + 1,
@@ -928,7 +928,8 @@ impl Screen {
.wrap(false);
}
}
- let next_cell = self.grid_mut().current_cell_mut();
+ let next_cell =
+ self.grid_mut().drawing_cell_mut(pos).unwrap();
next_cell.clear(crate::attrs::Attrs::default());
next_cell.set_wide_continuation(true);
self.grid_mut().col_inc(1);