fix: set nested before executing callback (#17801)

This commit is contained in:
TJ DeVries
2022-03-30 11:59:36 -04:00
committed by GitHub
parent 1217694f21
commit 7fb2310edb
2 changed files with 32 additions and 2 deletions

View File

@@ -2022,6 +2022,11 @@ char_u *getnextac(int c, void *cookie, int indent, bool do_concat)
verbose_leave_scroll();
}
// Make sure to set autocmd_nested before executing
// lua code, so that it works properly
autocmd_nested = ac->nested;
current_sctx = ac->script_ctx;
if (ac->exec.type == CALLABLE_CB) {
typval_T argsin = TV_INITIAL_VALUE;
typval_T rettv = TV_INITIAL_VALUE;
@@ -2052,8 +2057,6 @@ char_u *getnextac(int c, void *cookie, int indent, bool do_concat)
if (oneshot) {
aucmd_del(ac);
}
autocmd_nested = ac->nested;
current_sctx = ac->script_ctx;
if (ac->last) {
acp->nextcmd = NULL;
} else {