aboutsummaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2016-04-27 13:10:55 +0100
committerNicholas Marriott <nicholas.marriott@gmail.com>2016-04-27 13:10:55 +0100
commitfb4585bbe06df3ceec6c510f152a8014358cfd82 (patch)
treef24d1a3b5667a0ee8d5b1b6c2be679b8accc972a /utf8.c
parent61f231a496ff404ce811ece1389af1d929a39937 (diff)
parent55fdaab365830829d725d61c1ccf2cda0503651b (diff)
downloadrtmux-fb4585bbe06df3ceec6c510f152a8014358cfd82.tar.gz
rtmux-fb4585bbe06df3ceec6c510f152a8014358cfd82.tar.bz2
rtmux-fb4585bbe06df3ceec6c510f152a8014358cfd82.zip
Merge branch 'master' of github.com:tmux/tmux
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);