mirror of
https://github.com/vim/vim.git
synced 2025-09-30 04:44:14 -04:00
patch 8.2.2695: cursor position reset with nested autocommands
Problem: Cursor position reset with nested autocommands. Solution: Only check and reset line numbers for not nested autocommands. (closes #5820)
This commit is contained in:
@@ -2116,14 +2116,16 @@ apply_autocmds_group(
|
|||||||
ap->last = FALSE;
|
ap->last = FALSE;
|
||||||
ap->last = TRUE;
|
ap->last = TRUE;
|
||||||
|
|
||||||
// make sure cursor and topline are valid
|
if (nesting == 1)
|
||||||
check_lnums(TRUE);
|
// make sure cursor and topline are valid
|
||||||
|
check_lnums(TRUE);
|
||||||
|
|
||||||
do_cmdline(NULL, getnextac, (void *)&patcmd,
|
do_cmdline(NULL, getnextac, (void *)&patcmd,
|
||||||
DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT);
|
DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT);
|
||||||
|
|
||||||
// restore cursor and topline, unless they were changed
|
if (nesting == 1)
|
||||||
reset_lnums();
|
// restore cursor and topline, unless they were changed
|
||||||
|
reset_lnums();
|
||||||
|
|
||||||
#ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (eap != NULL)
|
if (eap != NULL)
|
||||||
|
@@ -2002,5 +2002,32 @@ func Test_terminal_all_ansi_colors()
|
|||||||
call delete('Xcolorscript')
|
call delete('Xcolorscript')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
function On_BufFilePost()
|
||||||
|
doautocmd <nomodeline> User UserEvent
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
func Test_terminal_nested_autocmd()
|
||||||
|
new
|
||||||
|
call setline(1, range(500))
|
||||||
|
$
|
||||||
|
let lastline = line('.')
|
||||||
|
|
||||||
|
augroup TermTest
|
||||||
|
autocmd BufFilePost * call On_BufFilePost()
|
||||||
|
autocmd User UserEvent silent
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
let cmd = Get_cat_123_cmd()
|
||||||
|
let buf = term_start(cmd, #{term_finish: 'close', hidden: 1})
|
||||||
|
call assert_equal(lastline, line('.'))
|
||||||
|
|
||||||
|
call TermWait(buf)
|
||||||
|
exe buf . 'bwipe'
|
||||||
|
call delete('Xtext')
|
||||||
|
augroup TermTest
|
||||||
|
au!
|
||||||
|
augroup END
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2695,
|
||||||
/**/
|
/**/
|
||||||
2694,
|
2694,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user