aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds2.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-05-03 01:45:35 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-05-03 02:08:18 -0400
commit96a8b0ab787c7d7148eb4c9881fdb5e022996081 (patch)
tree27565ee941cd97515399964f5e22018817a9d022 /src/nvim/ex_cmds2.c
parent4b287119fe798da1ca1ae5b96f6503972ed3a229 (diff)
downloadrneovim-96a8b0ab787c7d7148eb4c9881fdb5e022996081.tar.gz
rneovim-96a8b0ab787c7d7148eb4c9881fdb5e022996081.tar.bz2
rneovim-96a8b0ab787c7d7148eb4c9881fdb5e022996081.zip
vim-patch:8.1.0369: continuation lines cannot contain comments
Problem: Continuation lines cannot contain comments. Solution: Support using "\ . https://github.com/vim/vim/commit/67f8ab829911c7901c534ef2bf19cc34b622936f
Diffstat (limited to 'src/nvim/ex_cmds2.c')
-rw-r--r--src/nvim/ex_cmds2.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index 15b735dc9e..53a5018fe0 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -3403,13 +3403,18 @@ char_u *getsourceline(int c, void *cookie, int indent)
// Get the next line and concatenate it when it starts with a
// backslash. We always need to read the next line, keep it in
// sp->nextline.
+ // Also check for a comment in between continuation lines: "\ .
sp->nextline = get_one_sourceline(sp);
- if (sp->nextline != NULL && *(p = skipwhite(sp->nextline)) == '\\') {
+ if (sp->nextline != NULL
+ && (*(p = skipwhite(sp->nextline)) == '\\'
+ || (p[0] == '"' && p[1] == '\\' && p[2] == ' '))) {
garray_T ga;
ga_init(&ga, (int)sizeof(char_u), 400);
ga_concat(&ga, line);
- ga_concat(&ga, p + 1);
+ if (*p == '\\') {
+ ga_concat(&ga, p + 1);
+ }
for (;; ) {
xfree(sp->nextline);
sp->nextline = get_one_sourceline(sp);
@@ -3417,15 +3422,16 @@ char_u *getsourceline(int c, void *cookie, int indent)
break;
}
p = skipwhite(sp->nextline);
- if (*p != '\\') {
+ if (*p == '\\') {
+ // Adjust the growsize to the current length to speed up
+ // concatenating many lines.
+ if (ga.ga_len > 400) {
+ ga_set_growsize(&ga, (ga.ga_len > 8000) ? 8000 : ga.ga_len);
+ }
+ ga_concat(&ga, p + 1);
+ } else if (p[0] != '"' || p[1] != '\\' || p[2] != ' ') {
break;
}
- // Adjust the growsize to the current length to speed up
- // concatenating many lines.
- if (ga.ga_len > 400) {
- ga_set_growsize(&ga, (ga.ga_len > 8000) ? 8000 : ga.ga_len);
- }
- ga_concat(&ga, p + 1);
}
ga_append(&ga, NUL);
xfree(line);