Mercurial > vim
diff src/userfunc.c @ 28491:769599ee9f06 v8.2.4770
patch 8.2.4770: cannot easily mix expression and heredoc
Commit: https://github.com/vim/vim/commit/efbfa867a146fcd93fdec2435597aa4ae7f1325c
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Sun Apr 17 12:47:40 2022 +0100
patch 8.2.4770: cannot easily mix expression and heredoc
Problem: Cannot easily mix expression and heredoc.
Solution: Support in heredoc. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/10138)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 17 Apr 2022 14:00:04 +0200 |
parents | f24d4826e6bf |
children | c6aadb2c4cd7 |
line wrap: on
line diff
--- a/src/userfunc.c +++ b/src/userfunc.c @@ -1077,12 +1077,23 @@ get_function_body( || 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;