From e523a38bd2665a1a487382c5042d94770e4087af Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 6 Dec 2021 04:32:24 -0500 Subject: better (i think?) handling of weird character widths control codes are ignored completely, and everything else defaults to 1 instead of 0 --- src/screen.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/screen.rs') 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 -- cgit v1.2.3-54-g00ecf