From: zeertzjq Date: Fri, 12 Jun 2026 09:32:10 +0000 (+0000) Subject: patch 9.2.0621: 'autoindent' not stripped with virtualedit=onemore X-Git-Tag: v9.2.0621^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b13277edd935b78a20a0d679802a1cb789abfcf;p=thirdparty%2Fvim.git 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 Signed-off-by: glepnir Signed-off-by: Christian Brabandt --- diff --git a/src/edit.c b/src/edit.c index 3eba12dab5..c10654e368 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 902bbbfd1e..24a1903031 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\\", 'tnix') + call assert_equal([' x', ''], getline(1, '$')) + + %delete _ + setlocal virtualedit& + call feedkeys("i x\\", '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 8538d4ed35..fac15c00f3 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, /**/