vim-patch:8.1.53 use typval_T in the caller of call_vim_function

Problem:	unreliable types for complete function arguments
Solution:	fix argument type for functions w/ unreliable type conversion(Ozaki Kiichi)
vim/vim#2993
This commit is contained in:
cangscop
2019-07-27 03:13:29 +02:00
parent 0b4123668a
commit 0364e47ccb
4 changed files with 54 additions and 71 deletions

View File

@@ -3682,14 +3682,19 @@ expand_by_function (
return;
// Call 'completefunc' to obtain the list of matches.
const char_u *const args[2] = { (char_u *)"0", base };
typval_T args[3];
args[0].v_type = VAR_NUMBER;
args[1].v_type = VAR_STRING;
args[2].v_type = VAR_UNKNOWN;
args[0].vval.v_number = 0;
args[1].vval.v_string = base != NULL ? base : (char_u *)"";
pos = curwin->w_cursor;
curwin_save = curwin;
curbuf_save = curbuf;
/* Call a function, which returns a list or dict. */
if (call_vim_function(funcname, 2, args, FALSE, FALSE, &rettv) == OK) {
// Call a function, which returns a list or dict.
if (call_vim_function(funcname, 2, args, false, &rettv) == OK) {
switch (rettv.v_type) {
case VAR_LIST:
matchlist = rettv.vval.v_list;
@@ -4892,7 +4897,13 @@ static int ins_complete(int c, bool enable_pum)
return FAIL;
}
const char_u *const args[2] = { (char_u *)"1", NULL };
typval_T args[3];
args[0].v_type = VAR_NUMBER;
args[1].v_type = VAR_STRING;
args[2].v_type = VAR_UNKNOWN;
args[0].vval.v_number = 1;
args[1].vval.v_string = (char_u *)"";
pos = curwin->w_cursor;
curwin_save = curwin;
curbuf_save = curbuf;