diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2013-06-29 16:10:09 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2013-06-29 16:10:09 +0200 |
commit | 37b8aef96dc65a4c29fa3a2fc4c3d738a4e8cfe1 (patch) | |
tree | 5fcc2d5a5fdbdf58d1df06436426a0cf45d2609c /src/core | |
parent | b311ca894d9f32d7452ab9db0633af862d0a72c8 (diff) | |
download | weechat-37b8aef96dc65a4c29fa3a2fc4c3d738a4e8cfe1.zip |
core: move test of invalid UTF-8 char length from gui-chat.c to wee-utf8.c
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/wee-utf8.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/wee-utf8.c b/src/core/wee-utf8.c index d2db73cc6..6b193829c 100644 --- a/src/core/wee-utf8.c +++ b/src/core/wee-utf8.c @@ -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); |