aboutsummaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2016-04-27 12:01:10 +0100
committerThomas Adam <thomas@xteddy.org>2016-04-27 12:01:10 +0100
commit55fdaab365830829d725d61c1ccf2cda0503651b (patch)
tree83901d7b5be852429dbd1b86df8206ba07c5b7b1 /utf8.c
parent394589d493bd3487cc8b720afca949449a00c9c8 (diff)
parent1cedf78284a563b01e9394fa5b38c50470558868 (diff)
downloadrtmux-55fdaab365830829d725d61c1ccf2cda0503651b.tar.gz
rtmux-55fdaab365830829d725d61c1ccf2cda0503651b.tar.bz2
rtmux-55fdaab365830829d725d61c1ccf2cda0503651b.zip
Merge branch 'obsd-master'
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/utf8.c b/utf8.c
index 54cea671..87dce597 100644
--- a/utf8.c
+++ b/utf8.c
@@ -118,6 +118,14 @@ utf8_width(wchar_t wc)
width = wcwidth(wc);
if (width < 0 || width > 0xff) {
log_debug("Unicode %04x, wcwidth() %d", wc, width);
+
+ /*
+ * Many platforms have no width for relatively common
+ * characters (wcwidth() returns -1); assume width 1 in this
+ * case and hope for the best.
+ */
+ if (width < 0)
+ return (1);
return (-1);
}
return (width);