UTF-8 0x80-0x9f characters weren't treated as control chars as they should have

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4425 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2007-02-20 12:39:17 +00:00 committed by cras
parent e8f733d5f0
commit e9681e4b9e

View File

@ -342,6 +342,7 @@ static int view_line_draw(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line,
LINE_CACHE_REC *cache; LINE_CACHE_REC *cache;
const unsigned char *text, *end, *text_newline; const unsigned char *text, *end, *text_newline;
unsigned char *tmp; unsigned char *tmp;
unichar chr;
int xpos, color, drawcount, first, need_move, need_clrtoeol, char_width; int xpos, color, drawcount, first, need_move, need_clrtoeol, char_width;
if (view->dirty) /* don't bother drawing anything - redraw is coming */ if (view->dirty) /* don't bother drawing anything - redraw is coming */
@ -432,9 +433,9 @@ static int view_line_draw(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line,
continue; continue;
} }
chr = *text;
end = text; end = text;
if (view->utf8) { if (view->utf8) {
unichar chr;
if (get_utf8_char(&end, 6, &chr)<0) if (get_utf8_char(&end, 6, &chr)<0)
char_width = 1; char_width = 1;
else else
@ -450,15 +451,14 @@ static int view_line_draw(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line,
xpos += char_width; xpos += char_width;
if (xpos <= term_width) { if (xpos <= term_width) {
if (*text >= 32 && if ((chr & ~0x80) >= 32) {
(end != text || (*text & 127) >= 32)) {
for (; text < end; text++) for (; text < end; text++)
term_addch(view->window, *text); term_addch(view->window, *text);
term_addch(view->window, *text); term_addch(view->window, *text);
} else { } else {
/* low-ascii */ /* low-ascii */
term_set_color(view->window, ATTR_RESET|ATTR_REVERSE); term_set_color(view->window, ATTR_RESET|ATTR_REVERSE);
term_addch(view->window, (*text & 127)+'A'-1); term_addch(view->window, (chr & 127)+'A'-1);
term_set_color(view->window, color); term_set_color(view->window, color);
} }
} }