patch 8.2.2021: Vim9: get E1099 when autocommand resets did_emsg
Problem: Vim9: get E1099 when autocommand resets did_emsg.
Solution: Add did_emsg_cumul. (closes #7336)
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index dbaf218..a6bdac3 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -747,6 +747,9 @@
* cancel the whole command line, and any if/endif or loop.
* If force_abort is set, we cancel everything.
*/
+#ifdef FEAT_EVAL
+ did_emsg_cumul += did_emsg;
+#endif
did_emsg = FALSE;
/*
@@ -778,7 +781,12 @@
&& !(getline_is_func && func_has_abort(real_cookie))
#endif
)
+ {
+#ifdef FEAT_EVAL
+ did_emsg_cumul += did_emsg;
+#endif
did_emsg = FALSE;
+ }
/*
* 1. If repeating a line in a loop, get a line from lines_ga.
@@ -1026,7 +1034,10 @@
if (did_emsg && !force_abort
&& getline_equal(fgetline, cookie, get_func_line)
&& !func_has_abort(real_cookie))
+ {
+ // did_emsg_cumul is not set here
did_emsg = FALSE;
+ }
if (cstack.cs_looplevel > 0)
{