patch 8.2.4770: cannot easily mix expression and heredoc
Problem: Cannot easily mix expression and heredoc.
Solution: Support in heredoc. (Yegappan Lakshmanan, closes #10138)
diff --git a/src/userfunc.c b/src/userfunc.c
index 7ad3388..155c4ff 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -1077,12 +1077,23 @@
|| checkforcmd(&p, "const", 5))))
{
p = skipwhite(arg + 3);
- if (STRNCMP(p, "trim", 4) == 0)
+ while (TRUE)
{
- // Ignore leading white space.
- p = skipwhite(p + 4);
- heredoc_trimmed = vim_strnsave(theline,
- skipwhite(theline) - theline);
+ if (STRNCMP(p, "trim", 4) == 0)
+ {
+ // Ignore leading white space.
+ p = skipwhite(p + 4);
+ heredoc_trimmed = vim_strnsave(theline,
+ skipwhite(theline) - theline);
+ continue;
+ }
+ if (STRNCMP(p, "eval", 4) == 0)
+ {
+ // Ignore leading white space.
+ p = skipwhite(p + 4);
+ continue;
+ }
+ break;
}
skip_until = vim_strnsave(p, skiptowhite(p) - p);
getline_options = GETLINE_NONE;