summaryrefslogtreecommitdiff
path: root/src/scriptfile.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-07-19 14:41:58 +0200
committerBram Moolenaar <Bram@vim.org>2020-07-19 14:41:58 +0200
commit75783bd84e42e8431e4a62dfbabc9be1a1e56901 (patch)
tree3c62a332de2eee53b4b7e936b19bd29961dd3250 /src/scriptfile.c
parent65b9545f4494abcb455400c08e51de27bc305866 (diff)
downloadvim-git-75783bd84e42e8431e4a62dfbabc9be1a1e56901.tar.gz
patch 8.2.1243: Vim9: cannot have a comment line halfway a listv8.2.1243
Problem: Vim9: cannot have a comment or empty line halfway a list at script level. Solution: Skip more than one line if needed.
Diffstat (limited to 'src/scriptfile.c')
-rw-r--r--src/scriptfile.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/scriptfile.c b/src/scriptfile.c
index 4e7df4d0d..55145733e 100644
--- a/src/scriptfile.c
+++ b/src/scriptfile.c
@@ -1763,10 +1763,13 @@ getsourceline(int c UNUSED, void *cookie, int indent UNUSED, int do_concat)
// 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, int indent UNUSED, int do_concat)
}
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);