patch 8.2.0595: Vim9: not all commands using ends_excmd() tested
Problem: Vim9: not all commands using ends_excmd() tested.
Solution: Find # comment after regular commands. Add more tests. Report
error for where it was caused.
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 25040df..5c18b0b 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -1836,7 +1836,8 @@
*/
if (*ea.cmd == NUL || *ea.cmd == '"'
#ifdef FEAT_EVAL
- || (*ea.cmd == '#' && !starts_with_colon && in_vim9script())
+ || (*ea.cmd == '#' && ea.cmd[1] != '{'
+ && !starts_with_colon && in_vim9script())
#endif
|| (ea.nextcmd = check_nextcmd(ea.cmd)) != NULL)
{
@@ -4436,6 +4437,10 @@
|| p != eap->arg)
&& (eap->cmdidx != CMD_redir
|| p != eap->arg + 1 || p[-1] != '@'))
+#ifdef FEAT_EVAL
+ || (*p == '#' && in_vim9script()
+ && p[1] != '{' && p > eap->cmd && VIM_ISWHITE(p[-1]))
+#endif
|| *p == '|' || *p == '\n')
{
/*
@@ -4790,7 +4795,7 @@
int c = *cmd;
#ifdef FEAT_EVAL
- if (c == '#' && (cmd == cmd_start || VIM_ISWHITE(cmd[-1])))
+ if (c == '#' && cmd[1] != '{' && (cmd == cmd_start || VIM_ISWHITE(cmd[-1])))
return in_vim9script();
#endif
return (c == NUL || c == '|' || c == '"' || c == '\n');