vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 7be1b117eb7bf401259780a1d07a7deea53a8084
parent b754228772775da603e2178afc9bfd38d3a41612
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Thu, 11 Sep 2014 17:54:55 +0200

Fix bug when moving to characters with display width > 1

Diffstat:
Mwindow.c | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git 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;