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.master
parent
91fff2a2c8
commit
8686cb3d3d
|
@ -280,15 +280,13 @@ int mbwidth(const char *c)
|
|||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
mbtowc_reset();
|
||||
wc = bad_wchar;
|
||||
return 1;
|
||||
}
|
||||
|
||||
width = wcwidth(wc);
|
||||
|
||||
if (width == -1) {
|
||||
wc = bad_wchar;
|
||||
width = wcwidth(wc);
|
||||
}
|
||||
if (width == -1)
|
||||
return 1;
|
||||
|
||||
return width;
|
||||
} else
|
||||
|
|
Loading…
Reference in New Issue