diff src/autocmd.c @ 29438:87da4bab5aaa v9.0.0061

patch 9.0.0061: ml_get error with nested autocommand Commit: https://github.com/vim/vim/commit/5fa9f23a63651a8abdb074b4fc2ec9b1adc6b089 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 23 09:06:48 2022 +0100 patch 9.0.0061: ml_get error with nested autocommand Problem: ml_get error with nested autocommand. Solution: Also check line numbers for a nested autocommand. (closes https://github.com/vim/vim/issues/10761)
author Bram Moolenaar <Bram@vim.org>
date Sat, 23 Jul 2022 10:15:03 +0200
parents 175eacde28b8
children 827d9f2b7a71
line wrap: on
line diff
--- a/src/autocmd.c
+++ b/src/autocmd.c
@@ -2209,9 +2209,13 @@ apply_autocmds_group(
 	    ap->last = FALSE;
 	ap->last = TRUE;
 
+	// Make sure cursor and topline are valid.  The first time the current
+	// values are saved, restored by reset_lnums().  When nested only the
+	// values are corrected when needed.
 	if (nesting == 1)
-	    // make sure cursor and topline are valid
 	    check_lnums(TRUE);
+	else
+	    check_lnums_nested(TRUE);
 
 	save_did_emsg = did_emsg;