mirror of
https://github.com/irssi/irssi.git
synced 2026-08-10 12:23:37 +02:00
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
This commit is contained in:
parent
c6141f1144
commit
db705a8396
5 changed files with 143 additions and 61 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue