mirror of
https://github.com/irssi/irssi.git
synced 2026-08-08 19:30:15 +02:00
Simplify scrlen_str() using string_width().
This commit is contained in:
parent
29beafcf6f
commit
72064de9fe
1 changed files with 2 additions and 16 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 (string_policy(str) == TREAT_STRING_AS_UTF8) {
|
||||
|
||||
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