mirror of
https://github.com/tmux/tmux.git
synced 2025-03-30 03:18:51 +00:00
Restore utf8proc bits that went missing, GitHub issue 2564.
This commit is contained in:
parent
5b6d4c4fd1
commit
679b2288e8
8
utf8.c
8
utf8.c
@ -216,7 +216,11 @@ utf8_width(struct utf8_data *ud, int *width)
|
|||||||
{
|
{
|
||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
|
|
||||||
|
#ifdef HAVE_UTF8PROC
|
||||||
|
switch (utf8proc_mbtowc(&wc, ud->data, ud->size)) {
|
||||||
|
#else
|
||||||
switch (mbtowc(&wc, ud->data, ud->size)) {
|
switch (mbtowc(&wc, ud->data, ud->size)) {
|
||||||
|
#endif
|
||||||
case -1:
|
case -1:
|
||||||
log_debug("UTF-8 %.*s, mbtowc() %d", (int)ud->size, ud->data,
|
log_debug("UTF-8 %.*s, mbtowc() %d", (int)ud->size, ud->data,
|
||||||
errno);
|
errno);
|
||||||
@ -225,7 +229,11 @@ utf8_width(struct utf8_data *ud, int *width)
|
|||||||
case 0:
|
case 0:
|
||||||
return (UTF8_ERROR);
|
return (UTF8_ERROR);
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_UTF8PROC
|
||||||
|
*width = utf8proc_wcwidth(wc);
|
||||||
|
#else
|
||||||
*width = wcwidth(wc);
|
*width = wcwidth(wc);
|
||||||
|
#endif
|
||||||
if (*width >= 0 && *width <= 0xff)
|
if (*width >= 0 && *width <= 0xff)
|
||||||
return (UTF8_DONE);
|
return (UTF8_DONE);
|
||||||
log_debug("UTF-8 %.*s, wcwidth() %d", (int)ud->size, ud->data, *width);
|
log_debug("UTF-8 %.*s, wcwidth() %d", (int)ud->size, ud->data, *width);
|
||||||
|
Loading…
Reference in New Issue
Block a user