forked from PsychoticNinja/irssi
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:
parent
a429e2bf23
commit
ceea629e3e
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user