From d9f1a640d84054c5bcc513e0cbe34aad77c167bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Bohusl=C3=A1vek?= Date: Sun, 4 Jan 2015 11:10:33 +0100 Subject: 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. --- vis.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'vis.c') 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 }); } -- cgit v1.2.3