diff options
author | Timo Sirainen <cras@irssi.org> | 2002-03-10 19:03:27 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2002-03-10 19:03:27 +0000 |
commit | b18af319cfa50495780b673563ded5e1d4220353 (patch) | |
tree | 5cd4e29d77ab1177142e02f6a1d117237ffc4dbb | |
parent | e5ab1daf30d9bba4dfbb356c64c9eccf6f9fe638 (diff) | |
download | irssi-b18af319cfa50495780b673563ded5e1d4220353.zip |
term_addch() : utf-8 fixes for cursor positioning.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2563 dbcabf3a-b0e7-0310-adc4-f8d773084564
-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 30f7d11b..75f8f696 100644 --- a/src/fe-text/term-terminfo.c +++ b/src/fe-text/term-terminfo.c @@ -379,9 +379,15 @@ void term_addch(TERM_WINDOW *window, int chr) if (term_detached) return; if (vcmove) term_move_real(); - term_printed_text(1); - if (vcy != term_height || vcx != 0) - putc(chr, window->term->out); + + /* With UTF-8, move cursor only if this char is either single-byte + (8. bit on) or beginning of multibyte (7+8 bits on) */ + if (term_type != TERM_TYPE_UTF8 || + (chr & 0x80) == 0 || (chr & 0x40) == 0) { + term_printed_text(1); + if (vcy != term_height || vcx != 0) + putc(chr, window->term->out); + } } static void term_addch_utf8(TERM_WINDOW *window, unichar chr) |