aboutsummaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authornicm <nicm>2022-12-16 08:19:58 +0000
committernicm <nicm>2022-12-16 08:19:58 +0000
commit8bd17bff49888d11f9cb19955e778bdcbc4eeea6 (patch)
treea3d0e70ab583900566ce605b26acd96a644450b9 /utf8.c
parent3b3f42053a5f11af5285392a5a072facbc16f4a9 (diff)
downloadrtmux-8bd17bff49888d11f9cb19955e778bdcbc4eeea6.tar.gz
rtmux-8bd17bff49888d11f9cb19955e778bdcbc4eeea6.tar.bz2
rtmux-8bd17bff49888d11f9cb19955e778bdcbc4eeea6.zip
Make U+FE0F VARIATION SELECTOR-16 change the width from 1 to 2. GitHub
issue 3409.
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/utf8.c b/utf8.c
index 55a68110..03918cd2 100644
--- a/utf8.c
+++ b/utf8.c
@@ -227,12 +227,11 @@ utf8_width(struct utf8_data *ud, int *width)
return (UTF8_ERROR);
}
*width = wcwidth(wc);
- if (*width < 0 || *width > 0xff) {
- log_debug("UTF-8 %.*s, wcwidth() %d", (int)ud->size, ud->data,
- *width);
- return (UTF8_ERROR);
- }
- return (UTF8_DONE);
+ log_debug("UTF-8 %.*s %#x, wcwidth() %d", (int)ud->size, ud->data,
+ (u_int)wc, *width);
+ if (*width >= 0 && *width <= 0xff)
+ return (UTF8_DONE);
+ return (UTF8_ERROR);
}
/*