fix: incorrect draw cursor if a character is typically rendered in a double-width cell.

(East Asian utf-8 chars)
This commit is contained in:
Ilia Maslakov 2009-04-27 12:08:36 +00:00
parent 687ab30f74
commit 093d4c7e7a

View File

@ -1453,6 +1453,7 @@ long edit_move_forward3 (WEdit * edit, long current, int cols, long upto)
long p, q; long p, q;
int col = 0; int col = 0;
int cw = 1; int cw = 1;
gunichar utf_ch = 0;
if (upto) { if (upto) {
q = upto; q = upto;
cols = -10; cols = -10;
@ -1472,8 +1473,10 @@ long edit_move_forward3 (WEdit * edit, long current, int cols, long upto)
} else { } else {
cw = 1; cw = 1;
c = edit_get_byte (edit, p); c = edit_get_byte (edit, p);
edit_get_utf (edit, p, &cw); utf_ch = edit_get_utf (edit, p, &cw);
} }
if ( edit->utf8 && g_unichar_iswide(utf_ch) )
col++;
if (c == '\t') if (c == '\t')
col += TAB_SIZE - col % TAB_SIZE; col += TAB_SIZE - col % TAB_SIZE;
else if (c == '\n') { else if (c == '\n') {