vis

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

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

commit ba053e4ed4765ec9c1fbd09408021ea038d9e171
parent 6d34f3a3cab5438d687bcc3b824f75ff584d355a
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Wed, 27 Apr 2016 09:55:21 +0200

view: change view_cursors_place to take 1 based column number

This should fix inconsistency in the Lua API.

Diffstat:
Mview.c | 2+-
Mview.h | 1+
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/view.c b/view.c @@ -1336,7 +1336,7 @@ void view_cursors_to(Cursor *c, size_t pos) { void view_cursors_place(Cursor *c, size_t line, size_t col) { Text *txt = c->view->text; size_t pos = text_pos_by_lineno(txt, line); - pos = text_line_char_set(txt, pos, col); + pos = text_line_char_set(txt, pos, col > 0 ? col-1 : col); view_cursors_to(c, pos); } diff --git a/view.h b/view.h @@ -161,6 +161,7 @@ int view_cursors_cell_set(Cursor*, int cell); /* place cursor at `pos' which should be in the interval [0, text-size] */ void view_cursors_to(Cursor*, size_t pos); void view_cursors_scroll_to(Cursor*, size_t pos); +/* place cursor on given (line, column) pair, both values are 1-based */ void view_cursors_place(Cursor*, size_t line, size_t col); /* get register associated with this register */ Register *view_cursors_register(Cursor*);