summaryrefslogtreecommitdiffstats
path: root/st.c
diff options
context:
space:
mode:
authorczarkoff@gmail.com <czarkoff@gmail.com>2014-10-28 12:55:28 +0100
committerRoberto E. Vargas Caballero <k0ga@shike2.com>2014-11-03 22:52:58 +0100
commit11625c7166b7e4dad414606227acec2de1c36464 (patch)
tree7322869b5d1e0b33a480ce2e34973198b05ccc70 /st.c
parentAvoid failing when embedding with a Window id of 0 (diff)
downloadst-11625c7166b7e4dad414606227acec2de1c36464.tar.gz
st-11625c7166b7e4dad414606227acec2de1c36464.zip
Replace character with U+FFFD if wcwidth() is -1
Helpful when new Unicode codepoints are not recognized by libc.
Diffstat (limited to 'st.c')
-rw-r--r--st.c5
1 files changed, 4 insertions, 1 deletions
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) {
2576 unicodep = ascii = *c; 2576 unicodep = ascii = *c;
2577 } else { 2577 } else {
2578 utf8decode(c, &unicodep, UTF_SIZ); 2578 utf8decode(c, &unicodep, UTF_SIZ);
2579 width = wcwidth(unicodep); 2579 if ((width = wcwidth(unicodep)) == -1) {
2580 c = "\357\277\275"; /* UTF_INVALID */
2581 width = 1;
2582 }
2580 control = ISCONTROLC1(unicodep); 2583 control = ISCONTROLC1(unicodep);
2581 ascii = unicodep; 2584 ascii = unicodep;
2582 } 2585 }