diff options
author | Timo Sirainen <cras@irssi.org> | 2004-03-24 17:28:55 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2004-03-24 17:28:55 +0000 |
commit | db705a83964ddf3a19c013b5de6d05cb23a6eb11 (patch) | |
tree | 0ed2f46dea0face48c1e4d2bfd5bc1ec7c36336a /src/fe-text/term-terminfo.c | |
parent | c6141f11448e52afffe504b80c00042be0afbfec (diff) | |
download | irssi-db705a83964ddf3a19c013b5de6d05cb23a6eb11.zip |
Fixes for Chinese multibyte characters handling and cursor movement, patch
by Wang WenRui
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3244 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-text/term-terminfo.c')
-rw-r--r-- | src/fe-text/term-terminfo.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/fe-text/term-terminfo.c b/src/fe-text/term-terminfo.c index 2db5b2bb..42edd6dc 100644 --- a/src/fe-text/term-terminfo.c +++ b/src/fe-text/term-terminfo.c @@ -421,16 +421,22 @@ void term_add_unichar(TERM_WINDOW *window, unichar chr) if (vcy == term_height-1 && vcx == term_width-1) return; /* last char in screen */ - term_printed_text(1); switch (term_type) { case TERM_TYPE_UTF8: + term_printed_text(utf8_width(chr)); term_addch_utf8(window, chr); break; case TERM_TYPE_BIG5: - putc((chr >> 8) & 0xff, window->term->out); + if (chr > 0xff) { + term_printed_text(2); + putc((chr >> 8) & 0xff, window->term->out); + } else { + term_printed_text(1); + } putc((chr & 0xff), window->term->out); break; default: + term_printed_text(1); putc(chr, window->term->out); break; } @@ -443,7 +449,7 @@ void term_addstr(TERM_WINDOW *window, const char *str) if (term_detached) return; if (vcmove) term_move_real(); - len = strlen(str); + len = strlen(str); /* FIXME utf8 or big5 */ term_printed_text(len); if (vcy != term_height || vcx != 0) |