#endif
EXTERN char e_ambiguous_use_of_user_defined_command[]
INIT(= N_("E464: Ambiguous use of user-defined command"));
+EXTERN char e_ambiguous_use_of_user_defined_command_str[]
+ INIT(= N_("E464: Ambiguous use of user-defined command: %s"));
EXTERN char e_winsize_requires_two_number_arguments[]
INIT(= N_("E465: :winsize requires two number arguments"));
EXTERN char e_winpos_requires_two_number_arguments[]
if (errormsg != NULL && *errormsg != NUL && !did_emsg)
{
- if (sourcing)
+ if (sourcing || !KeyTyped)
{
if (errormsg != (char *)IObuff)
{
Nested()
enddef
+def Test_ambigous_command_error()
+ var lines =<< trim END
+ vim9script
+ command CmdA echomsg 'CmdA'
+ command CmdB echomsg 'CmdB'
+ Cmd
+ END
+ CheckScriptFailure(lines, 'E464: Ambiguous use of user-defined command: Cmd', 4)
+
+ lines =<< trim END
+ vim9script
+ def Func()
+ Cmd
+ enddef
+ Func()
+ END
+ CheckScriptFailure(lines, 'E464: Ambiguous use of user-defined command: Cmd', 1)
+
+ lines =<< trim END
+ vim9script
+ nnoremap <F3> <ScriptCmd>Cmd<CR>
+ feedkeys("\<F3>", 'xt')
+ END
+ CheckScriptFailure(lines, 'E464: Ambiguous use of user-defined command: Cmd', 3)
+
+ delcommand CmdA
+ delcommand CmdB
+ nunmap <F3>
+enddef
+
" Execute this near the end, profiling doesn't stop until Vim exits.
" This only tests that it works, not the profiling output.
def Test_xx_profile_with_lambda()
if (p == NULL)
{
if (cctx.ctx_skip != SKIP_YES)
- emsg(_(e_ambiguous_use_of_user_defined_command));
+ semsg(_(e_ambiguous_use_of_user_defined_command_str), ea.cmd);
goto erret;
}