diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-04-03 13:19:26 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-04-03 13:19:26 +0200 |
commit | 1e6bbfb5607c82d872070219c26e2aae20db68ed (patch) | |
tree | 4ce3964ede62bb6e8960e76b294211b62c11f54e /src/autocmd.c | |
parent | 5b8cabfef7c3707f3e53e13844d90e5a217e1e84 (diff) |
patch 8.2.2695: cursor position reset with nested autocommandsv8.2.2695
Problem: Cursor position reset with nested autocommands.
Solution: Only check and reset line numbers for not nested autocommands.
(closes #5820)
Diffstat (limited to 'src/autocmd.c')
-rw-r--r-- | src/autocmd.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/autocmd.c b/src/autocmd.c index ede8e7dbe0..4c12e729e0 100644 --- a/src/autocmd.c +++ b/src/autocmd.c @@ -2116,14 +2116,16 @@ apply_autocmds_group( ap->last = FALSE; ap->last = TRUE; - // make sure cursor and topline are valid - check_lnums(TRUE); + if (nesting == 1) + // make sure cursor and topline are valid + check_lnums(TRUE); do_cmdline(NULL, getnextac, (void *)&patcmd, DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT); - // restore cursor and topline, unless they were changed - reset_lnums(); + if (nesting == 1) + // restore cursor and topline, unless they were changed + reset_lnums(); #ifdef FEAT_EVAL if (eap != NULL) |