mirror of
https://github.com/irssi/irssi.git
synced 2026-08-09 03:40:16 +02:00
Merge pull request #480 from xavierog/handle-utf8-nicks-with-mk_wcwidth
Handle utf8 nicks with mk_wcwidth()
This commit is contained in:
commit
74d38683bf
14 changed files with 261 additions and 140 deletions
|
|
@ -366,22 +366,8 @@ static int scrlen_str(const char *str)
|
|||
char *stripped;
|
||||
g_return_val_if_fail(str != NULL, 0);
|
||||
|
||||
str = stripped = strip_codes(str);
|
||||
if (is_utf8() && g_utf8_validate(str, -1, NULL)) {
|
||||
|
||||
while (*str != '\0') {
|
||||
gunichar c;
|
||||
|
||||
c = g_utf8_get_char(str);
|
||||
str = g_utf8_next_char(str);
|
||||
|
||||
len += unichar_isprint(c) ? mk_wcwidth(c) : 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
len = strlen(str);
|
||||
}
|
||||
|
||||
stripped = strip_codes(str);
|
||||
len = string_width(stripped, -1);
|
||||
g_free(stripped);
|
||||
return len;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue