vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 0a2d5d1eb3b2bc779cea4010a56e07e64dfecbe3 parent 656aa60bded26e11813bb3acda9dc8c9cba04cc4 Author: Marc André Tanner <mat@brain-dump.org> Date: Fri, 15 Apr 2016 22:13:10 +0200 view: add view_cursors_place(cursor, line, col) function Diffstat:
| M | view.c | | | 7 | +++++++ |
| M | view.h | | | 1 | + |
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/view.c b/view.c @@ -1324,6 +1324,13 @@ void view_cursors_to(Cursor *c, size_t pos) { cursor_to(c, 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); + view_cursors_to(c, pos); +} + void view_cursors_selection_start(Cursor *c) { if (c->sel) return; diff --git a/view.h b/view.h @@ -159,6 +159,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); +void view_cursors_place(Cursor*, size_t line, size_t col); /* get register associated with this register */ Register *view_cursors_register(Cursor*); /* start selected area at current cursor position. further cursor movements