1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-29 14:26:39 +02:00

core: move test of invalid UTF-8 char length from gui-chat.c to wee-utf8.c

This commit is contained in:
Sebastien Helleu
2013-06-29 16:10:09 +02:00
parent b311ca894d
commit 37b8aef96d
2 changed files with 9 additions and 9 deletions
+8
View File
@@ -424,7 +424,15 @@ utf8_strlen_screen (const char *string)
}
if (mbstowcs (ptr_wstring, string, num_char) != (size_t)(-1))
{
length = wcswidth (ptr_wstring, num_char);
/*
* ensure the size is always >= 1, to prevent any display bug
* (for example size of UTF-8 char U+26C4 is -1, why? mystery...)
*/
if (length < 1)
length = 1;
}
else
length = utf8_strlen (string);