mirror of
https://github.com/irssi/irssi.git
synced 2025-02-02 15:08:01 -05:00
Simplify scrlen_str() using string_width().
This commit is contained in:
parent
29beafcf6f
commit
72064de9fe
@ -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…
x
Reference in New Issue
Block a user