mirror of
https://github.com/irssi/irssi.git
synced 2026-08-10 20:33:46 +02:00
Replace utf8_width with Markus Kuhn's wcwidth.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4518 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
24bf34c6ca
commit
a8741bd799
8 changed files with 230 additions and 83 deletions
|
|
@ -141,7 +141,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 += utf8_width(*p);
|
||||
xpos += mk_wcwidth(*p);
|
||||
else
|
||||
xpos++;
|
||||
}
|
||||
|
|
@ -158,7 +158,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 = utf8_width(*p);
|
||||
width = mk_wcwidth(*p);
|
||||
else
|
||||
width = 1;
|
||||
|
||||
|
|
@ -223,7 +223,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 += utf8_width(*p);
|
||||
xpos += mk_wcwidth(*p);
|
||||
else
|
||||
xpos++;
|
||||
|
||||
|
|
@ -513,7 +513,7 @@ static size_t cell_width(unichar *buf, int len)
|
|||
{
|
||||
unichar *str = buf;
|
||||
|
||||
while (len-- && utf8_width(*str--) == 0);
|
||||
while (len-- && mk_wcwidth(*str--) == 0);
|
||||
return buf - str;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -425,7 +425,7 @@ void term_add_unichar(TERM_WINDOW *window, unichar chr)
|
|||
|
||||
switch (term_type) {
|
||||
case TERM_TYPE_UTF8:
|
||||
term_printed_text(utf8_width(chr));
|
||||
term_printed_text(mk_wcwidth(chr));
|
||||
term_addch_utf8(window, chr);
|
||||
break;
|
||||
case TERM_TYPE_BIG5:
|
||||
|
|
|
|||
|
|
@ -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 = utf8_width(chr);
|
||||
char_len = mk_wcwidth(chr);
|
||||
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 = utf8_width(chr);
|
||||
char_width = mk_wcwidth(chr);
|
||||
} else {
|
||||
if (term_type == TERM_TYPE_BIG5 &&
|
||||
is_big5(end[0], end[1]))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue