From 1d5222985ccad4cd31c4b7498810ff2968dd33a2 Mon Sep 17 00:00:00 2001 From: Pavel Platto Date: Mon, 19 Jan 2015 22:34:23 +0200 Subject: vim-patch:7.4.492 Problem: In Insert mode, after inserting a newline that inserts a comment leader, CTRL-O moves to the right. (ZyX) Issue 57. Solution: Correct the condition for moving the cursor back to the NUL. (Christian Brabandt) https://code.google.com/p/vim/source/detail?r=v7-4-492 --- src/nvim/edit.c | 8 ++++++-- src/nvim/version.c | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src/nvim') diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 4c00547daa..f6ca11761a 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -5751,8 +5751,12 @@ stop_insert ( } if (curwin->w_cursor.lnum != tpos.lnum) curwin->w_cursor = tpos; - else if (cc != NUL) - ++curwin->w_cursor.col; /* put cursor back on the NUL */ + else { + tpos.col++; + if (cc != NUL && gchar_pos(&tpos) == NUL) { + ++curwin->w_cursor.col; // put cursor back on the NUL + } + } /* may have started Visual mode, adjust the position for * deleted characters. */ diff --git a/src/nvim/version.c b/src/nvim/version.c index e34db7f40a..5e3331317d 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -253,7 +253,7 @@ static int included_patches[] = { //495 NA 494, 493, - //492, + 492, 491, 490, 489, -- cgit