1
0
forked from aniani/vim

patch 8.2.4514: Vim9: some flow commands can be shortened

Problem:    Vim9: some flow commands can be shortened.
Solution:   Also require using the full name for ":return", ":enddef",
            ":continue", ":export" and ":import".
This commit is contained in:
Bram Moolenaar
2022-03-05 20:24:41 +00:00
parent b29ae15977
commit b2175220da
6 changed files with 40 additions and 10 deletions

View File

@@ -3753,16 +3753,14 @@ find_ex_command(
// :Print and :mode are not supported in Vim9 script.
// Some commands cannot be shortened in Vim9 script.
// ":continue" needs at least ":cont", since ":con" looks weird.
if (vim9 && eap->cmdidx != CMD_SIZE)
{
if (eap->cmdidx == CMD_mode || eap->cmdidx == CMD_Print)
eap->cmdidx = CMD_SIZE;
else if (((cmdnames[eap->cmdidx].cmd_argt & EX_WHOLE)
else if ((cmdnames[eap->cmdidx].cmd_argt & EX_WHOLE)
&& len < (int)STRLEN(cmdnames[eap->cmdidx].cmd_name))
|| (eap->cmdidx == CMD_continue && len < 4))
{
semsg(_(e_command_cannot_be_shortened), eap->cmd);
semsg(_(e_command_cannot_be_shortened_str), eap->cmd);
eap->cmdidx = CMD_SIZE;
}
}