patch 9.0.0476: varargs does not work for replacement function of substitute()
Problem: Varargs does not work for replacement function of substitute().
Solution: Check the varargs flag of the function. (closes #11142)
diff --git a/src/regexp.c b/src/regexp.c
index 8e6e9c4..1bd1261 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -1817,14 +1817,14 @@
* call_func() by vim_regsub_both().
*/
static int
-fill_submatch_list(int argc UNUSED, typval_T *argv, int argskip, int argcount)
+fill_submatch_list(int argc UNUSED, typval_T *argv, int argskip, ufunc_T *fp)
{
listitem_T *li;
int i;
char_u *s;
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;