summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2016-04-26 07:33:37 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2016-04-26 07:33:37 +0000
commita13f256c054eb15cf1bcdc62478d37c569dc63e3 (patch)
tree6c6d4a0d7961ddd3148c8d314657ae38d7f18537 /usr.bin/tmux
parent24decadef12db5d1c85575250f23530d74b2460d (diff)
Log wcwidth() and mbtowc() failure to make it easier to debug a Unicode
codepoint not appearing.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/utf8.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/tmux/utf8.c b/usr.bin/tmux/utf8.c
index 9c9aa223cb2..7c6845f0e93 100644
--- a/usr.bin/tmux/utf8.c
+++ b/usr.bin/tmux/utf8.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: utf8.c,v 1.29 2016/03/02 15:36:03 nicm Exp $ */
+/* $OpenBSD: utf8.c,v 1.30 2016/04/26 07:33:36 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -18,6 +18,7 @@
#include <sys/types.h>
+#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <vis.h>
@@ -116,8 +117,10 @@ utf8_width(wchar_t wc)
int width;
width = wcwidth(wc);
- if (width < 0 || width > 0xff)
+ if (width < 0 || width > 0xff) {
+ log_debug("Unicode %04x, wcwidth() %d", wc, width);
return (-1);
+ }
return (width);
}
@@ -127,6 +130,8 @@ utf8_combine(const struct utf8_data *ud, wchar_t *wc)
{
switch (mbtowc(wc, ud->data, ud->size)) {
case -1:
+ log_debug("UTF-8 %.*s, mbtowc() %d", (int)ud->size, ud->data,
+ errno);
mbtowc(NULL, NULL, MB_CUR_MAX);
return (UTF8_ERROR);
case 0: