aboutsummaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
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 56281aa2..22ab62c1 100644
--- a/utf8.c
+++ b/utf8.c
@@ -119,6 +119,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);