aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2014-09-11 17:54:55 +0200
committerMarc André Tanner <mat@brain-dump.org>2014-09-11 17:54:55 +0200
commitae450167e7f0574876db44bbe434c4021ee02979 (patch)
treeb1c8c62506473841667ef5a2485eb07092f00cf1
parent6c5bdddbb5e7f79a04a0ee2bd7a9252035151812 (diff)
downloadvis-ae450167e7f0574876db44bbe434c4021ee02979.tar.gz
vis-ae450167e7f0574876db44bbe434c4021ee02979.tar.xz
Fix bug when moving to characters with display width > 1
-rw-r--r--window.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/window.c b/window.c
index 4a80331..e9ab2d5 100644
--- a/window.c
+++ b/window.c
@@ -301,10 +301,9 @@ void window_cursor_to(Win *win, size_t pos) {
int max_col = MIN(win->width, line->width);
while (cur < pos && col < max_col) {
cur += line->cells[col].len;
- col++;
+ /* skip over columns occupied by the same character */
+ while (++col < max_col && line->cells[col].len == 0);
}
- while (col < max_col && line->cells[col].data == '\t')
- col++;
} else {
line = win->bottomline;
row = win->height - 1;