vis

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

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

commit 4b940e51a25b8926c612dd3a5a82fe79918f3910
parent 0e5b472b0e2c5cde409e4c4fe6a8d5800da7f70d
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Tue, 13 Jan 2015 19:48:04 +0100

Cleanup nn| implementation

This command does not really do what it advertises because
it operates on bytes not columns.

Diffstat:
Mvis.c | 10++--------
1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/vis.c b/vis.c @@ -784,14 +784,8 @@ static size_t line(const Arg *arg) { } static size_t column(const Arg *arg) { - char c; - EditorWin *win = vis->win; - size_t pos = window_cursor_get(win->win); - Iterator it = text_iterator_get(win->text, text_line_begin(win->text, pos)); - int count = action.count; - while (count > 0 && text_iterator_byte_get(&it, &c) && c != '\n') - text_iterator_byte_next(&it, NULL); - return it.pos; + size_t pos = window_cursor_get(vis->win->win); + return text_line_offset(vis->win->text, pos, action.count); } static size_t window_lines_top(const Arg *arg) {