diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2015-07-27 22:00:53 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2015-07-28 13:21:50 +0200 |
| commit | 1dfef906f43eb1d950d71cb6e44d6b83e2d158f3 (patch) | |
| tree | 0cfd84d6c9b2ec87a833cec9c84c75b334f2ea82 /vis.c | |
| parent | b134abd515969c123182d5f20008a5f89bd7bfe4 (diff) | |
| download | vis-1dfef906f43eb1d950d71cb6e44d6b83e2d158f3.tar.gz vis-1dfef906f43eb1d950d71cb6e44d6b83e2d158f3.tar.xz | |
vis: CTRL+J and CTRL+K creates a new cursor on the line below/above
Diffstat (limited to 'vis.c')
| -rw-r--r-- | vis.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -320,6 +320,8 @@ static void totill_repeat(const Arg *arg); static void totill_reverse(const Arg *arg); /* replace character at cursor with one read form keyboard */ static void replace(const Arg *arg); +/* create a new cursor on the previous (arg->i < 0) or next (arg->i > 0) line */ +static void cursors_new(const Arg *arg); /* remove all but the primary cursor and their selections */ static void cursors_clear(const Arg *arg); /* adjust action.count by arg->i */ @@ -827,6 +829,19 @@ static void totill_reverse(const Arg *arg) { movement(&(const Arg){ .i = type }); } +static void cursors_new(const Arg *arg) { + View *view = vis->win->view; + Text *txt = vis->win->file->text; + size_t pos = view_cursor_get(view); + if (arg->i > 0) + pos = text_line_down(txt, pos); + else if (arg->i < 0) + pos = text_line_up(txt, pos); + Cursor *cursor = view_cursors_new(view); + if (cursor) + view_cursors_to(cursor, pos); +} + static void cursors_clear(const Arg *arg) { View *view = vis->win->view; if (view_cursors_count(view) > 1) |
