aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Bohuslávek <mbohuslavek@gmail.com>2015-01-04 11:10:33 +0100
committerMarc André Tanner <mat@brain-dump.org>2015-01-04 22:31:50 +0100
commitd9f1a640d84054c5bcc513e0cbe34aad77c167bc (patch)
tree3325483e510e85e44b7e5f4a894bf713354f1459
parent07ad51e37e23934ea0f79202713cb5004aeefef0 (diff)
downloadvis-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.
-rw-r--r--vis.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/vis.c b/vis.c
index cb401d9..d86b9ec 100644
--- a/vis.c
+++ b/vis.c
@@ -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 });
}