aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/regexp.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-09-16 19:40:52 +0800
committerGitHub <noreply@github.com>2022-09-16 19:40:52 +0800
commit622968d7b389b8334ee2f2550c3a00018c4f1879 (patch)
treeda7c99dd4cc41e3fe6e3ffecdfc7e5f6de4285f8 /src/nvim/regexp.c
parent3dda52d860eb4937127693d4660db18305069370 (diff)
downloadrneovim-622968d7b389b8334ee2f2550c3a00018c4f1879.tar.gz
rneovim-622968d7b389b8334ee2f2550c3a00018c4f1879.tar.bz2
rneovim-622968d7b389b8334ee2f2550c3a00018c4f1879.zip
vim-patch:9.0.0476: varargs does not work for replacement function of substitute() (#20216)
Problem: Varargs does not work for replacement function of substitute(). Solution: Check the varargs flag of the function. (closes vim/vim#11142) https://github.com/vim/vim/commit/48db5dafecacced4a9e42de3f92838b2d59beb4c
Diffstat (limited to 'src/nvim/regexp.c')
-rw-r--r--src/nvim/regexp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index 99e18bdeb1..e87382ff7c 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -1605,12 +1605,12 @@ static regsubmatch_T rsm; // can only be used when can_f_submatch is true
/// Put the submatches in "argv[argskip]" which is a list passed into
/// call_func() by vim_regsub_both().
-static int fill_submatch_list(int argc FUNC_ATTR_UNUSED, typval_T *argv, int argskip, int argcount)
+static int fill_submatch_list(int argc FUNC_ATTR_UNUSED, typval_T *argv, int argskip, ufunc_T *fp)
FUNC_ATTR_NONNULL_ALL
{
typval_T *listarg = argv + argskip;
- if (argcount == argskip) {
+ if (!fp->uf_varargs && fp->uf_args.ga_len <= argskip) {
// called function doesn't take a submatches argument
return argskip;
}