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:
parent
73a0268dfd
commit
1618264cb7
1 changed files with 5 additions and 1 deletions
|
|
@ -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 {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue