summaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-05-06 21:51:50 +0100
committerBram Moolenaar <Bram@vim.org>2022-05-06 21:51:50 +0100
commit39be4981cdd93a185b110536f84d99ce56e2c3cc (patch)
tree099caa31cf7913347f4cc5d0f8c7fde1b1130035 /src/eval.c
parenta13e7acba9928a9c5e97be28946418d8d4323988 (diff)
patch 8.2.4897: comment inside an expression in lambda ignores the restv8.2.4897
Problem: Comment inside an expression in lambda ignores the rest of the expression. Solution: Truncate the line at the comment. (closes #10367)
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/eval.c b/src/eval.c
index 317446c762..41094cd69f 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2208,8 +2208,15 @@ eval_next_line(char_u *arg, evalarg_T *evalarg)
garray_T *gap = &evalarg->eval_ga;
char_u *line;
- if (arg != NULL && *arg == NL)
- return skipwhite(arg + 1);
+ if (arg != NULL)
+ {
+ if (*arg == NL)
+ return skipwhite(arg + 1);
+ // Truncate before a trailing comment, so that concatenating the lines
+ // won't turn the rest into a comment.
+ if (*skipwhite(arg) == '#')
+ *arg = NUL;
+ }
if (evalarg->eval_cookie != NULL)
line = evalarg->eval_getline(0, evalarg->eval_cookie, 0,