0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.4897: comment inside an expression in lambda ignores the rest

Problem:    Comment inside an expression in lambda ignores the rest of the
            expression.
Solution:   Truncate the line at the comment. (closes #10367)
This commit is contained in:
Bram Moolenaar
2022-05-06 21:51:50 +01:00
parent a13e7acba9
commit 39be4981cd
3 changed files with 21 additions and 2 deletions

View File

@@ -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,