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

@@ -2096,13 +2096,15 @@ static void op_function(oparg_T *oap)
decl(&curbuf->b_op_end);
}
const char_u *const argv[1] = {
(const char_u *)(((const char *const[]) {
typval_T argv[2];
argv[0].v_type = VAR_STRING;
argv[1].v_type = VAR_UNKNOWN;
argv[0].vval.v_string =
(char_u *)(((const char *const[]) {
[kMTBlockWise] = "block",
[kMTLineWise] = "line",
[kMTCharWise] = "char",
})[oap->motion_type]),
};
})[oap->motion_type]);
// Reset virtual_op so that 'virtualedit' can be changed in the
// function.