• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Révision44cb142c86156d6c3ba5bdbf264a026eefbafeb4 (tree)
l'heure2022-01-20 06:00:03
AuteurBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Message de Log

patch 8.2.4147: E464 does not always include the offending command

Commit: https://github.com/vim/vim/commit/bed34f0a8a4e38a72a080184881bc68254a8cdc6
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jan 19 20:48:37 2022 +0000

patch 8.2.4147: E464 does not always include the offending command
Problem: E464 does not always include the offending command.
Solution: Add another error message with "%s". (closes https://github.com/vim/vim/issues/9564)

Change Summary

Modification

diff -r 6cf6cf88dc33 -r 44cb142c8615 src/errors.h
--- a/src/errors.h Wed Jan 19 18:30:08 2022 +0100
+++ b/src/errors.h Wed Jan 19 22:00:03 2022 +0100
@@ -1148,6 +1148,8 @@
11481148 #endif
11491149 EXTERN char e_ambiguous_use_of_user_defined_command[]
11501150 INIT(= N_("E464: Ambiguous use of user-defined command"));
1151+EXTERN char e_ambiguous_use_of_user_defined_command_str[]
1152+ INIT(= N_("E464: Ambiguous use of user-defined command: %s"));
11511153 EXTERN char e_winsize_requires_two_number_arguments[]
11521154 INIT(= N_("E465: :winsize requires two number arguments"));
11531155 EXTERN char e_winpos_requires_two_number_arguments[]
diff -r 6cf6cf88dc33 -r 44cb142c8615 src/ex_docmd.c
--- a/src/ex_docmd.c Wed Jan 19 18:30:08 2022 +0100
+++ b/src/ex_docmd.c Wed Jan 19 22:00:03 2022 +0100
@@ -2614,7 +2614,7 @@
26142614
26152615 if (errormsg != NULL && *errormsg != NUL && !did_emsg)
26162616 {
2617- if (sourcing)
2617+ if (sourcing || !KeyTyped)
26182618 {
26192619 if (errormsg != (char *)IObuff)
26202620 {
diff -r 6cf6cf88dc33 -r 44cb142c8615 src/testdir/test_vim9_script.vim
--- a/src/testdir/test_vim9_script.vim Wed Jan 19 18:30:08 2022 +0100
+++ b/src/testdir/test_vim9_script.vim Wed Jan 19 22:00:03 2022 +0100
@@ -3664,6 +3664,36 @@
36643664 Nested()
36653665 enddef
36663666
3667+def Test_ambigous_command_error()
3668+ var lines =<< trim END
3669+ vim9script
3670+ command CmdA echomsg 'CmdA'
3671+ command CmdB echomsg 'CmdB'
3672+ Cmd
3673+ END
3674+ CheckScriptFailure(lines, 'E464: Ambiguous use of user-defined command: Cmd', 4)
3675+
3676+ lines =<< trim END
3677+ vim9script
3678+ def Func()
3679+ Cmd
3680+ enddef
3681+ Func()
3682+ END
3683+ CheckScriptFailure(lines, 'E464: Ambiguous use of user-defined command: Cmd', 1)
3684+
3685+ lines =<< trim END
3686+ vim9script
3687+ nnoremap <F3> <ScriptCmd>Cmd<CR>
3688+ feedkeys("\<F3>", 'xt')
3689+ END
3690+ CheckScriptFailure(lines, 'E464: Ambiguous use of user-defined command: Cmd', 3)
3691+
3692+ delcommand CmdA
3693+ delcommand CmdB
3694+ nunmap <F3>
3695+enddef
3696+
36673697 " Execute this near the end, profiling doesn't stop until Vim exits.
36683698 " This only tests that it works, not the profiling output.
36693699 def Test_xx_profile_with_lambda()
diff -r 6cf6cf88dc33 -r 44cb142c8615 src/version.c
--- a/src/version.c Wed Jan 19 18:30:08 2022 +0100
+++ b/src/version.c Wed Jan 19 22:00:03 2022 +0100
@@ -751,6 +751,8 @@
751751 static int included_patches[] =
752752 { /* Add new patch number below this line */
753753 /**/
754+ 4147,
755+/**/
754756 4146,
755757 /**/
756758 4145,
diff -r 6cf6cf88dc33 -r 44cb142c8615 src/vim9compile.c
--- a/src/vim9compile.c Wed Jan 19 18:30:08 2022 +0100
+++ b/src/vim9compile.c Wed Jan 19 22:00:03 2022 +0100
@@ -2878,7 +2878,7 @@
28782878 if (p == NULL)
28792879 {
28802880 if (cctx.ctx_skip != SKIP_YES)
2881- emsg(_(e_ambiguous_use_of_user_defined_command));
2881+ semsg(_(e_ambiguous_use_of_user_defined_command_str), ea.cmd);
28822882 goto erret;
28832883 }
28842884
Afficher sur ancien navigateur de dépôt.