1
0
mirror of https://github.com/irssi/irssi.git synced 2024-09-22 04:35:58 -04:00

Move the cursor cell-wise in utf8.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4520 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Emanuele Giaquinta 2007-05-25 22:13:24 +00:00 committed by exg
parent a429e2bf23
commit ceea629e3e

View File

@ -777,6 +777,13 @@ void gui_entry_move_pos(GUI_ENTRY_REC *entry, int pos)
if (entry->pos + pos >= 0 && entry->pos + pos <= entry->text_len)
entry->pos += pos;
if (entry->utf8) {
int step = pos < 0 ? -1 : 1;
while(mk_wcwidth(entry->text[entry->pos]) == 0 &&
entry->pos + step >= 0 && entry->pos + step <= entry->text_len)
entry->pos += step;
}
gui_entry_fix_cursor(entry);
gui_entry_draw(entry);
}