diff options
author | ailin-nemui <ailin-nemui@users.noreply.github.com> | 2016-05-18 09:18:21 +0200 |
---|---|---|
committer | ailin-nemui <ailin-nemui@users.noreply.github.com> | 2016-05-18 09:18:21 +0200 |
commit | 74d38683bf5f20142b14dcd5162fd258d8fb2f37 (patch) | |
tree | 7e4fdf05e76005ff0e469ac168b1da0cd48d9da1 /src/fe-text | |
parent | 5564f850418d54f13befe15bec5481d29026b7d3 (diff) | |
parent | 5d69b4c4a7d334ca29e61969712f5f8eedfa5cd9 (diff) | |
download | irssi-74d38683bf5f20142b14dcd5162fd258d8fb2f37.zip |
Merge pull request #480 from xavierog/handle-utf8-nicks-with-mk_wcwidth
Handle utf8 nicks with mk_wcwidth()
Diffstat (limited to 'src/fe-text')
-rw-r--r-- | src/fe-text/gui-entry.c | 18 | ||||
-rw-r--r-- | src/fe-text/term.h | 2 |
2 files changed, 3 insertions, 17 deletions
diff --git a/src/fe-text/gui-entry.c b/src/fe-text/gui-entry.c index 31fe0e1e..82645a8e 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 (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; } diff --git a/src/fe-text/term.h b/src/fe-text/term.h index 9b726d82..0c7847f6 100644 --- a/src/fe-text/term.h +++ b/src/fe-text/term.h @@ -27,7 +27,7 @@ typedef struct _TERM_WINDOW TERM_WINDOW; #define TERM_TYPE_UTF8 1 #define TERM_TYPE_BIG5 2 -typedef guint32 unichar; +#include "utf8.h" extern TERM_WINDOW *root_window; extern int term_width, term_height; |