X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=st.c;h=ad52280d62898b01f457600187d6f923aa3e00a9;hb=11625c7166b7e4dad414606227acec2de1c36464;hp=23dd7f1fd76d500252a75c33425b24e3d6aaec2e;hpb=008aae541b5cb1e67a025048adef9a06eaa11c2e;p=st.git diff --git a/st.c b/st.c index 23dd7f1..ad52280 100644 --- a/st.c +++ b/st.c @@ -2576,7 +2576,10 @@ tputc(char *c, int len) { unicodep = ascii = *c; } else { utf8decode(c, &unicodep, UTF_SIZ); - width = wcwidth(unicodep); + if ((width = wcwidth(unicodep)) == -1) { + c = "\357\277\275"; /* UTF_INVALID */ + width = 1; + } control = ISCONTROLC1(unicodep); ascii = unicodep; }