diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-08-20 15:52:35 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-20 15:52:35 +0800 |
commit | bffaf1e27e49c3dbbc0b59d023a0fd9243e254aa (patch) | |
tree | 58ab40613eff5c678deced1c5fca3c8ad4c244d7 /src | |
parent | 1a57cd383684b7488e02e094f49dfe607bc53632 (diff) | |
download | rneovim-bffaf1e27e49c3dbbc0b59d023a0fd9243e254aa.tar.gz rneovim-bffaf1e27e49c3dbbc0b59d023a0fd9243e254aa.tar.bz2 rneovim-bffaf1e27e49c3dbbc0b59d023a0fd9243e254aa.zip |
fix(eval): check for v:lua when calling callback (#19855)
This makes callback_call() match call_vim_function() when calling a function.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/eval.c | 12 | ||||
-rw-r--r-- | src/nvim/ops.c | 2 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 21068e9101..f2fe106224 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -5842,7 +5842,17 @@ bool callback_call(Callback *const callback, const int argcount_in, typval_T *co switch (callback->type) { case kCallbackFuncref: name = callback->data.funcref; - partial = NULL; + int len = (int)STRLEN(name); + if (len >= 6 && !memcmp(name, "v:lua.", 6)) { + name += 6; + len = check_luafunc_name(name, false); + if (len == 0) { + return false; + } + partial = vvlua_partial; + } else { + partial = NULL; + } break; case kCallbackPartial: diff --git a/src/nvim/ops.c b/src/nvim/ops.c index b4fc7534bc..50f9650a8a 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -6191,7 +6191,7 @@ static void op_function(const oparg_T *oap) finish_op = false; typval_T rettv; - if (callback_call(&opfunc_cb, 1, argv, &rettv) != FAIL) { + if (callback_call(&opfunc_cb, 1, argv, &rettv)) { tv_clear(&rettv); } |