diff options
| author | Michal Bohuslávek <mbohuslavek@gmail.com> | 2015-01-04 11:10:33 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2015-01-04 22:31:50 +0100 |
| commit | d9f1a640d84054c5bcc513e0cbe34aad77c167bc (patch) | |
| tree | 3325483e510e85e44b7e5f4a894bf713354f1459 /vis.c | |
| parent | 07ad51e37e23934ea0f79202713cb5004aeefef0 (diff) | |
| download | vis-d9f1a640d84054c5bcc513e0cbe34aad77c167bc.tar.gz vis-d9f1a640d84054c5bcc513e0cbe34aad77c167bc.tar.xz | |
Fix openline command on the first line
When on the first line, openline command wouldn't move the cursor to the
newly created line above the current line.
Diffstat (limited to 'vis.c')
| -rw-r--r-- | vis.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -1127,9 +1127,14 @@ static void put(const Arg *arg) { } static void openline(const Arg *arg) { - movement(&(const Arg){ .i = arg->i == MOVE_LINE_NEXT ? - MOVE_LINE_END : MOVE_LINE_PREV }); - insert_newline(NULL); + if (arg->i == MOVE_LINE_NEXT) { + movement(&(const Arg){ .i = MOVE_LINE_END }); + insert_newline(NULL); + } else { + movement(&(const Arg){ .i = MOVE_LINE_BEGIN }); + insert_newline(NULL); + movement(&(const Arg){ .i = MOVE_LINE_PREV }); + } switchmode(&(const Arg){ .i = VIS_MODE_INSERT }); } |
