diff options
author | Emanuele Giaquinta <exg@irssi.org> | 2007-05-25 22:13:24 +0000 |
---|---|---|
committer | exg <exg@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2007-05-25 22:13:24 +0000 |
commit | ceea629e3ea0a3c8f7befe55e7afa47daa07fdd7 (patch) | |
tree | fdffbec63f1f1b3ec5e934b0fdc51f700125c3eb /src/fe-text/gui-entry.c | |
parent | a429e2bf23a4584f50df7d92b724fc34828deff9 (diff) | |
download | irssi-ceea629e3ea0a3c8f7befe55e7afa47daa07fdd7.zip |
Move the cursor cell-wise in utf8.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4520 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-text/gui-entry.c')
-rw-r--r-- | src/fe-text/gui-entry.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/fe-text/gui-entry.c b/src/fe-text/gui-entry.c index be778224..c045de83 100644 --- a/src/fe-text/gui-entry.c +++ b/src/fe-text/gui-entry.c @@ -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); } |