diff src/scriptfile.c @ 21385:54a304e4dc57 v8.2.1243

patch 8.2.1243: Vim9: cannot have a comment line halfway a list Commit: https://github.com/vim/vim/commit/75783bd84e42e8431e4a62dfbabc9be1a1e56901 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 19 14:41:58 2020 +0200 patch 8.2.1243: Vim9: cannot have a comment line halfway a list Problem: Vim9: cannot have a comment or empty line halfway a list at script level. Solution: Skip more than one line if needed.
author Bram Moolenaar <Bram@vim.org>
date Sun, 19 Jul 2020 14:45:03 +0200
parents 8d1d11afd8c8
children 6f5129b51c49
line wrap: on
line diff
--- a/src/scriptfile.c
+++ b/src/scriptfile.c
@@ -1763,10 +1763,13 @@ getsourceline(int c UNUSED, void *cookie
 	// backslash. We always need to read the next line, keep it in
 	// sp->nextline.
 	/* Also check for a comment in between continuation lines: "\ */
+	// Also check for a Vim9 comment and empty line.
 	sp->nextline = get_one_sourceline(sp);
 	if (sp->nextline != NULL
 		&& (*(p = skipwhite(sp->nextline)) == '\\'
-			      || (p[0] == '"' && p[1] == '\\' && p[2] == ' ')))
+			      || (p[0] == '"' && p[1] == '\\' && p[2] == ' ')
+			      || (in_vim9script()
+				  && (*p == NUL || vim9_comment_start(p)))))
 	{
 	    garray_T    ga;
 
@@ -1794,8 +1797,11 @@ getsourceline(int c UNUSED, void *cookie
 		    }
 		    ga_concat(&ga, p + 1);
 		}
-		else if (p[0] != '"' || p[1] != '\\' || p[2] != ' ')
+		else if (!(p[0] == '"' && p[1] == '\\' && p[2] == ' ')
+			&& !(in_vim9script()
+				      && (*p == NUL || vim9_comment_start(p))))
 		    break;
+		/* drop a # comment or "\ comment line */
 	    }
 	    ga_append(&ga, NUL);
 	    vim_free(line);