diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-03-27 16:14:48 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-03-28 12:25:05 +0200 |
| commit | 8965cd21386683cae680ba7de4b6a6ee6687e17f (patch) | |
| tree | b4920c2958069cff877a778bf0dbf3e8578e71a9 /view.c | |
| parent | f567d332bec0e7d31b7214e4065663e5349b2252 (diff) | |
| download | vis-8965cd21386683cae680ba7de4b6a6ee6687e17f.tar.gz vis-8965cd21386683cae680ba7de4b6a6ee6687e17f.tar.xz | |
view: change cursor creation API to take an initial position
Diffstat (limited to 'view.c')
| -rw-r--r-- | view.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -737,7 +737,7 @@ View *view_new(Text *text, lua_State *lua) { View *view = calloc(1, sizeof(View)); if (!view) return NULL; - if (!view_cursors_new(view)) { + if (!view_cursors_new(view, EPOS)) { view_free(view); return NULL; } @@ -1051,17 +1051,18 @@ size_t view_screenline_goto(View *view, int n) { return pos; } -Cursor *view_cursors_new(View *view) { +Cursor *view_cursors_new(View *view, size_t pos) { Cursor *c = calloc(1, sizeof(*c)); if (!c) return NULL; - c->view = view; c->next = view->cursors; if (view->cursors) view->cursors->prev = c; view->cursors = c; view->cursor = c; + if (pos != EPOS) + view_cursors_to(c, pos); return c; } |
