diff options
author | Xavier G <xavier.github@kindwolf.org> | 2016-05-13 04:19:38 +0200 |
---|---|---|
committer | Xavier G <xavier.github@kindwolf.org> | 2016-05-13 04:19:38 +0200 |
commit | 72064de9fe064a7536b501fc470edf75fc393314 (patch) | |
tree | f79b4f98208923f6efbcbf85295ccafacbdaae78 /src/fe-text | |
parent | 29beafcf6fd50ecb8a9f3b2b642c2d29c022a4e3 (diff) | |
download | irssi-72064de9fe064a7536b501fc470edf75fc393314.zip |
Simplify scrlen_str() using string_width().
Diffstat (limited to 'src/fe-text')
-rw-r--r-- | src/fe-text/gui-entry.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/fe-text/gui-entry.c b/src/fe-text/gui-entry.c index beea2273..949a43d3 100644 --- a/src/fe-text/gui-entry.c +++ b/src/fe-text/gui-entry.c @@ -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; } |