aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-12-06 04:32:24 -0500
committerJesse Luehrs <doy@tozt.net>2021-12-06 04:32:24 -0500
commite523a38bd2665a1a487382c5042d94770e4087af (patch)
tree62c39d7cd350c57d9684c135b528df5a1b87772e /src
parentd94ec144dd1ca29886ebbc438882e73af6fe0ae9 (diff)
downloadvt100-rust-e523a38bd2665a1a487382c5042d94770e4087af.tar.gz
vt100-rust-e523a38bd2665a1a487382c5042d94770e4087af.zip
better (i think?) handling of weird character widths
control codes are ignored completely, and everything else defaults to 1 instead of 0
Diffstat (limited to 'src')
-rw-r--r--src/cell.rs2
-rw-r--r--src/screen.rs7
2 files changed, 7 insertions, 2 deletions
diff --git a/src/cell.rs b/src/cell.rs
index 7262c8d..857c9e2 100644
--- a/src/cell.rs
+++ b/src/cell.rs
@@ -36,7 +36,7 @@ impl Cell {
// strings in this context should always be an arbitrary character
// followed by zero or more zero-width characters, so we should only
// have to look at the first character
- self.set_wide(c.width().unwrap_or(0) > 1);
+ self.set_wide(c.width().unwrap_or(1) > 1);
self.attrs = a;
}
diff --git a/src/screen.rs b/src/screen.rs
index ae6bd2d..558c41f 100644
--- a/src/screen.rs
+++ b/src/screen.rs
@@ -820,7 +820,12 @@ impl Screen {
let size = self.grid().size();
let attrs = self.attrs;
- let width = c.width().unwrap_or(0).try_into().unwrap();
+ let width = c.width();
+ if width.is_none() && (c as u32) < 256 {
+ // don't even try to draw control characters
+ return;
+ }
+ let width = width.unwrap_or(1).try_into().unwrap();
// it doesn't make any sense to wrap if the last column in a row
// didn't already have contents. don't try to handle the case where a