0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 8.2.2134: Vim9: get E1099 when autocmd triggered in builtin function

Problem:    Vim9: get E1099 when autocmd triggered in builtin function.
Solution:   Check that did_emsg increased instead of checking that it changed.
            (closes #7448)
This commit is contained in:
Bram Moolenaar
2020-12-12 20:42:19 +01:00
parent 2a9d5d386b
commit 57f799e6a4
3 changed files with 23 additions and 1 deletions

View File

@@ -1824,6 +1824,26 @@ def Test_reset_did_emsg()
delfunc! g:Func
enddef
def Test_did_emsg_reset()
# executing an autocommand resets did_emsg, this should not result in a
# builtin function considered failing
var lines =<< trim END
vim9script
au BufWinLeave * #
def Func()
popup_menu('', {callback: {-> popup_create('', {})->popup_close()}})
eval [][0]
enddef
nno <F3> <cmd>call <sid>Func()<cr>
feedkeys("\<F3>\e", 'xt')
END
writefile(lines, 'XemsgReset')
assert_fails('so XemsgReset', ['E684:', 'E684:'], lines, 2)
delete('XemsgReset')
nunmap <F3>
au! BufWinLeave
enddef
def Test_abort_with_silent_call()
var lines =<< trim END
vim9script

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2134,
/**/
2133,
/**/

View File

@@ -583,7 +583,7 @@ call_bfunc(int func_idx, int argcount, ectx_T *ectx)
for (idx = 0; idx < argcount; ++idx)
clear_tv(&argvars[idx]);
if (did_emsg != did_emsg_before)
if (did_emsg > did_emsg_before)
return FAIL;
return OK;
}