diff src/ex_docmd.c @ 20079:336483164ca6 v8.2.0595

patch 8.2.0595: Vim9: not all commands using ends_excmd() tested Commit: https://github.com/vim/vim/commit/a26b9700d73ebccd6c5459d0d66032a4249f6b72 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 18 19:53:28 2020 +0200 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.
author Bram Moolenaar <Bram@vim.org>
date Sat, 18 Apr 2020 20:00:04 +0200
parents 516b10943fdb
children 165ec447ca77
line wrap: on
line diff
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -1836,7 +1836,8 @@ do_one_cmd(
      */
     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 @@ separate_nextcmd(exarg_T *eap)
 			|| 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 @@ ends_excmd2(char_u *cmd_start UNUSED, ch
     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');