Skip to content

Commit

Permalink
view: add view_cursors_place(cursor, line, col) function
Browse files Browse the repository at this point in the history
  • Loading branch information
martanne committed Apr 15, 2016
1 parent 0987fdd commit b9007ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions view.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions view.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b9007ca

Please sign in to comment.