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:
Timo Sirainen 2004-03-24 17:28:55 +00:00 committed by cras
commit db705a8396
5 changed files with 143 additions and 61 deletions

View file

@ -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)