Commit 8686cb3d authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

chars: measure invalid sequences and unassigned codepoints more quickly

Invalid multibyte sequences get depicted with the Replacement Character,
and unassigned codepoints are shown as if they were a space.  Both have
a width of one.
No related merge requests found
Showing with 3 additions and 5 deletions
+3 -5
...@@ -280,15 +280,13 @@ int mbwidth(const char *c) ...@@ -280,15 +280,13 @@ int mbwidth(const char *c)
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) { if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
mbtowc_reset(); mbtowc_reset();
wc = bad_wchar; return 1;
} }
width = wcwidth(wc); width = wcwidth(wc);
if (width == -1) { if (width == -1)
wc = bad_wchar; return 1;
width = wcwidth(wc);
}
return width; return width;
} else } else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment