Skip to content

Instantly share code, notes, and snippets.

@machakann
Created May 23, 2018 05:00
Show Gist options
  • Save machakann/ef78414c6fd696ebc68987cfcd85ac77 to your computer and use it in GitHub Desktop.
Save machakann/ef78414c6fd696ebc68987cfcd85ac77 to your computer and use it in GitHub Desktop.
diff --git a/src/edit.c b/src/edit.c
index ef4c98d29..8467994dd 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -5441,7 +5441,7 @@ ins_complete(int c, int enable_pum)
pos = curwin->w_cursor;
curwin_save = curwin;
curbuf_save = curbuf;
- col = call_func_retnr(funcname, 2, args, FALSE);
+ col = call_func_retnr(funcname, 2, args, FALSE, FALSE);
if (curwin_save != curwin || curbuf_save != curbuf)
{
EMSG(_(e_complwin));
diff --git a/src/eval.c b/src/eval.c
index 2ba9e82a8..13d20d328 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1101,13 +1101,13 @@ call_func_retnr(
char_u *func,
int argc,
char_u **argv,
- int safe) /* use the sandbox */
+ int safe, /* use the sandbox */
+ int str_arg_only) /* all arguments are strings */
{
typval_T rettv;
varnumber_T retval;
- /* All arguments are passed as strings, no conversion to number. */
- if (call_vim_function(func, argc, argv, safe, TRUE, &rettv) == FAIL)
+ if (call_vim_function(func, argc, argv, safe, str_arg_only, &rettv) == FAIL)
return -1;
retval = get_tv_number_chk(&rettv, NULL);
diff --git a/src/mbyte.c b/src/mbyte.c
index b79783527..cfe8202e7 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -4801,7 +4801,7 @@ call_imactivatefunc(int active)
argv[0] = (char_u *)"1";
else
argv[0] = (char_u *)"0";
- (void)call_func_retnr(p_imaf, 1, argv, FALSE);
+ (void)call_func_retnr(p_imaf, 1, argv, FALSE, TRUE);
}
static int
@@ -4815,7 +4815,7 @@ call_imstatusfunc(void)
/* FIXME: :py print 'xxx' is shown duplicate result.
* Use silent to avoid it. */
++msg_silent;
- is_active = call_func_retnr(p_imsf, 0, NULL, FALSE);
+ is_active = call_func_retnr(p_imsf, 0, NULL, FALSE, TRUE);
--msg_silent;
return (is_active > 0);
}
diff --git a/src/normal.c b/src/normal.c
index 3b958a5b5..16142a94e 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -2248,7 +2248,7 @@ op_function(oparg_T *oap UNUSED)
virtual_op = MAYBE;
# endif
- (void)call_func_retnr(p_opfunc, 1, argv, FALSE);
+ (void)call_func_retnr(p_opfunc, 1, argv, FALSE, TRUE);
# ifdef FEAT_VIRTUALEDIT
virtual_op = save_virtual_op;
diff --git a/src/proto/eval.pro b/src/proto/eval.pro
index a096156ae..a30532ba2 100644
--- a/src/proto/eval.pro
+++ b/src/proto/eval.pro
@@ -20,7 +20,7 @@ list_T *eval_spell_expr(char_u *badword, char_u *expr);
int get_spellword(list_T *list, char_u **pp);
typval_T *eval_expr(char_u *arg, char_u **nextcmd);
int call_vim_function(char_u *func, int argc, char_u **argv, int safe, int str_arg_only, typval_T *rettv);
-varnumber_T call_func_retnr(char_u *func, int argc, char_u **argv, int safe);
+varnumber_T call_func_retnr(char_u *func, int argc, char_u **argv, int safe, int str_arg_only);
void *call_func_retstr(char_u *func, int argc, char_u **argv, int safe);
void *call_func_retlist(char_u *func, int argc, char_u **argv, int safe);
int eval_foldexpr(char_u *arg, int *cp);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment