patch 9.2.0549: Cursor wrong after autoindent strip is skipped

Commit: 
https://github.com/vim/vim/commit/179f9efc7ec49f7fb9965d86734973bdac135870
Author: glepnir <[email protected]>
Date:   Thu May 28 20:13:48 2026 +0000

    patch 9.2.0549: Cursor wrong after autoindent strip is skipped
    
    Problem:  cursor lands on the wrong line when a <Cmd> mapping or autocmd
              modifies lines during insert and the strip is skipped
              (after v9.2.0510)
    Solution: Restore cursor to tpos when skipwhite skips the strip, instead
              of leaving it at end_insert_pos (glepnir).
    
    related: #20290
    closes:  #20332
    
    Signed-off-by: glepnir <[email protected]>
    Signed-off-by: Kristijan Husak <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/edit.c b/src/edit.c
index d59db1afd..2b839d7f5 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -2657,6 +2657,9 @@ stop_insert(
                if (VIsual_active)
                    check_visual_pos();
            }
+           else
+               // Non-whitespace follows, keep original cursor.
+               curwin->w_cursor = tpos;
        }
     }
     did_ai = FALSE;
diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim
index af8359e0d..f76b9196f 100644
--- a/src/testdir/test_edit.vim
+++ b/src/testdir/test_edit.vim
@@ -2496,4 +2496,22 @@ func Test_open_square_mark_after_ctrl_r_ctrl_p_paste()
   bwipe!
 endfunc
 
+func Test_autoindent_no_strip_cross_line()
+  new
+  setlocal autoindent
+  inoremap <buffer> <F3> {}<Left><CR><Cmd>normal! ==<CR><Up><End><CR>
+
+  call setline(1, '')
+  call feedkeys("i\<F3>\<Esc>", 'tx')
+
+  call assert_equal('{', getline(1))
+  call assert_equal('', getline(2))
+  call assert_equal('}', getline(3))
+  call assert_equal([0, 2, 1, 0], getpos('.'))
+
+  " Overwrite @. register with simple content to avoid affecting later tests.
+  call feedkeys("Go\<Esc>", 'tnix')
+  bwipe!
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 7b71661ea..575332e4e 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    549,
 /**/
     548,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1wShMh-00BSkA-SG%40256bit.org.

Raspunde prin e-mail lui