mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
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 <glephunter@gmail.com>
Signed-off-by: Kristijan Husak <husakkristijan@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
af8845e3af
commit
179f9efc7e
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -729,6 +729,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
549,
|
||||
/**/
|
||||
548,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user