diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-04-29 08:12:32 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-04-29 09:20:52 +0800 |
commit | 4bcf8c15b3079ca72d6557890b50b35565fcd577 (patch) | |
tree | cc6a986bd307aec948e1f696f6755c5874e1b451 /src/nvim/eval/userfunc.c | |
parent | 291fd767e3979b25146c32115eacc3c2f8e1e517 (diff) | |
download | rneovim-4bcf8c15b3079ca72d6557890b50b35565fcd577.tar.gz rneovim-4bcf8c15b3079ca72d6557890b50b35565fcd577.tar.bz2 rneovim-4bcf8c15b3079ca72d6557890b50b35565fcd577.zip |
vim-patch:8.2.0578: heredoc for interfaces does not support "trim"
Problem: Heredoc for interfaces does not support "trim".
Solution: Update the script heredoc support to be same as the :let command.
(Yegappan Lakshmanan, closes vim/vim#5916)
https://github.com/vim/vim/commit/6c2b7b8055b96463f78abb70f58c4c6d6d4b9d55
Diffstat (limited to 'src/nvim/eval/userfunc.c')
-rw-r--r-- | src/nvim/eval/userfunc.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c index 0e22cf54cf..1f5a6eaec4 100644 --- a/src/nvim/eval/userfunc.c +++ b/src/nvim/eval/userfunc.c @@ -2571,11 +2571,18 @@ void ex_function(exarg_T *eap) && (!ASCII_ISALPHA(p[2]) || p[2] == 's')))) { // ":python <<" continues until a dot, like ":append" p = skipwhite(arg + 2); + if (strncmp(p, "trim", 4) == 0) { + // Ignore leading white space. + p = skipwhite(p + 4); + heredoc_trimmed = xstrnsave(theline, (size_t)(skipwhite(theline) - theline)); + } if (*p == NUL) { skip_until = xstrdup("."); } else { - skip_until = xstrdup(p); + skip_until = xstrnsave(p, (size_t)(skiptowhite(p) - p)); } + do_concat = false; + is_heredoc = true; } // Check for ":let v =<< [trim] EOF" |