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 <zeertzjq@outlook.com>
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
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;
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
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 621,
/**/
620,
/**/