From 132377cc333bb84c80e88d320e4d77c17ae5c628 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Tue, 12 Apr 2022 09:52:03 -0700 Subject: [PATCH] termwiz: treat graphemes in Unassigned range as width=1 rather than 0 Otherwise we filter them out of the terminal model and they effectively vanish. refs: #1864 --- termwiz/src/cell.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/termwiz/src/cell.rs b/termwiz/src/cell.rs index bba3aac95..14807a893 100644 --- a/termwiz/src/cell.rs +++ b/termwiz/src/cell.rs @@ -881,7 +881,13 @@ pub fn grapheme_column_width(s: &str, version: Option) -> usize .chars() .map(|c| { let c = WcWidth::from_char(c); - if version >= 9 { + + // Special case for symbol fonts that are naughtly and use + // the unassigned range instead of the private use range. + // + if c == WcWidth::Unassigned { + 1 + } else if version >= 9 { c.width_unicode_9_or_later() } else { c.width_unicode_8_or_earlier()