Fix newlines causing bad rendering artifacts

The unicode-width crate has started to consider newlines to have a width
of 1 instead of 0.
This commit is contained in:
Joscha 2025-02-20 21:24:07 +01:00
parent 73a0268dfd
commit 1618264cb7

View file

@ -47,9 +47,13 @@ impl WidthDb {
if grapheme == "\t" { if grapheme == "\t" {
return self.tab_width_at_column(col); return self.tab_width_at_column(col);
} }
if grapheme.chars().any(|c| c.is_ascii_control()) {
return 0; // See measure_widths function
}
if !self.active { if !self.active {
return grapheme.width() as u8; return grapheme.width() as u8;
} }
if let Some(width) = self.known.get(grapheme) { if let Some(width) = self.known.get(grapheme) {
*width *width
} else { } else {