Commit: patch 9.2.0621: 'autoindent' not stripped with virtualedit=onemore

1 view
Skip to first unread message

Christian Brabandt

unread,
5:45 AM (6 hours ago) 5:45 AM
to vim...@googlegroups.com
patch 9.2.0621: 'autoindent' not stripped with virtualedit=onemore

Commit: https://github.com/vim/vim/commit/4b13277edd935b78a20a0d679802a1cb789abfcf
Author: zeertzjq <zeer...@outlook.com>
Date: Fri Jun 12 09:32:10 2026 +0000

patch 9.2.0621: 'autoindent' not stripped with virtualedit=onemore

Problem: 'autoindent' not stripped with virtualedit=onemore (after
9.2.0510).
Solution: Restore the decrement of cursor column when it's on NUL.

fixes: neovim/neovim#40183
closes: #20476

Signed-off-by: zeertzjq <zeer...@outlook.com>
Signed-off-by: glepnir <gleph...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/edit.c b/src/edit.c
index 3eba12dab..c10654e36 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -2670,6 +2670,8 @@ stop_insert(
curwin->w_cursor.col = strip_col;
for (;;)
{
+ if (gchar_cursor() == NUL && curwin->w_cursor.col > 0)
+ --curwin->w_cursor.col;
cc = gchar_cursor();
if (!VIM_ISWHITE(cc))
break;
diff --git a/src/testdir/test_virtualedit.vim b/src/testdir/test_virtualedit.vim
index 902bbbfd1..24a190303 100644
--- a/src/testdir/test_virtualedit.vim
+++ b/src/testdir/test_virtualedit.vim
@@ -788,4 +788,18 @@ func Test_set_virtualedit_on_mode_change()
bwipe!
endfunc

+func Test_strip_autoindent_with_virtualedit_onemore()
+ new
+ setlocal autoindent virtualedit=onemore
+ call feedkeys("i x\<CR>\<Esc>", 'tnix')
+ call assert_equal([' x', ''], getline(1, '$'))
+
+ %delete _
+ setlocal virtualedit&
+ call feedkeys("i x\<CR>\<Esc>", 'tnix')
+ call assert_equal([' x', ''], getline(1, '$'))
+
+ bwipe!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 8538d4ed3..fac15c00f 100644
--- a/src/version.c
+++ b/src/version.c
@@ -754,6 +754,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 621,
/**/
620,
/**/
Reply all
Reply to author
Forward
0 new messages