1
0
mirror of https://github.com/irssi/irssi.git synced 2024-06-23 06:35:36 +00:00

Assume width 1 for control characters in places where a non-negative width is

expected.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4535 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Emanuele Giaquinta 2007-05-31 13:56:35 +00:00 committed by exg
parent d3687d8a97
commit 5bcafebbd4
4 changed files with 7 additions and 7 deletions

View File

@ -306,7 +306,7 @@ static int advance (char const **str, gboolean utf8)
c = g_utf8_get_char(*str);
*str = g_utf8_next_char(*str);
return mk_wcwidth(c);
return unichar_isprint(c) ? mk_wcwidth(c) : 1;
} else {
*str += 1;

View File

@ -166,7 +166,7 @@ static int pos2scrpos(GUI_ENTRY_REC *entry, int pos)
if (term_type == TERM_TYPE_BIG5)
xpos += big5_width(*p);
else if (entry->utf8)
xpos += mk_wcwidth(*p);
xpos += unichar_isprint(*p) ? mk_wcwidth(*p) : 1;
else
xpos++;
}
@ -183,7 +183,7 @@ static int scrpos2pos(GUI_ENTRY_REC *entry, int pos)
if (term_type == TERM_TYPE_BIG5)
width = big5_width(*p);
else if (entry->utf8)
width = mk_wcwidth(*p);
width = unichar_isprint(*p) ? mk_wcwidth(*p) : 1;
else
width = 1;
@ -248,7 +248,7 @@ static void gui_entry_draw_from(GUI_ENTRY_REC *entry, int pos)
else if (term_type == TERM_TYPE_BIG5)
xpos += big5_width(*p);
else if (entry->utf8)
xpos += mk_wcwidth(*p);
xpos += unichar_isprint(*p) ? mk_wcwidth(*p) : 1;
else
xpos++;

View File

@ -425,7 +425,7 @@ void term_add_unichar(TERM_WINDOW *window, unichar chr)
switch (term_type) {
case TERM_TYPE_UTF8:
term_printed_text(mk_wcwidth(chr));
term_printed_text(unichar_isprint(chr) ? mk_wcwidth(chr) : 1);
term_addch_utf8(window, chr);
break;
case TERM_TYPE_BIG5:

View File

@ -218,7 +218,7 @@ view_update_line_cache(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line)
if (get_utf8_char(&next_ptr, char_len, &chr) < 0)
char_len = 1;
else
char_len = mk_wcwidth(chr);
char_len = unichar_isprint(chr) ? mk_wcwidth(chr) : 1;
next_ptr++;
}
@ -439,7 +439,7 @@ static int view_line_draw(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line,
if (get_utf8_char(&end, 6, &chr)<0)
char_width = 1;
else
char_width = mk_wcwidth(chr);
char_width = unichar_isprint(chr) ? mk_wcwidth(chr) : 1;
} else {
if (term_type == TERM_TYPE_BIG5 &&
is_big5(end[0], end[1]))