mirror of
https://github.com/LukeSmithxyz/st.git
synced 2024-11-22 07:15:59 +01:00
Replace character with U+FFFD if wcwidth() is -1
Helpful when new Unicode codepoints are not recognized by libc.
This commit is contained in:
parent
008aae541b
commit
11625c7166
1 changed files with 4 additions and 1 deletions
5
st.c
5
st.c
|
@ -2576,7 +2576,10 @@ tputc(char *c, int len) {
|
||||||
unicodep = ascii = *c;
|
unicodep = ascii = *c;
|
||||||
} else {
|
} else {
|
||||||
utf8decode(c, &unicodep, UTF_SIZ);
|
utf8decode(c, &unicodep, UTF_SIZ);
|
||||||
width = wcwidth(unicodep);
|
if ((width = wcwidth(unicodep)) == -1) {
|
||||||
|
c = "\357\277\275"; /* UTF_INVALID */
|
||||||
|
width = 1;
|
||||||
|
}
|
||||||
control = ISCONTROLC1(unicodep);
|
control = ISCONTROLC1(unicodep);
|
||||||
ascii = unicodep;
|
ascii = unicodep;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue