mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 19:38:20 +00:00
fix(eval): check for v:lua when calling callback (#19855)
This makes callback_call() match call_vim_function() when calling a function.
This commit is contained in:
@@ -5842,7 +5842,17 @@ bool callback_call(Callback *const callback, const int argcount_in, typval_T *co
|
|||||||
switch (callback->type) {
|
switch (callback->type) {
|
||||||
case kCallbackFuncref:
|
case kCallbackFuncref:
|
||||||
name = callback->data.funcref;
|
name = callback->data.funcref;
|
||||||
|
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;
|
partial = NULL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kCallbackPartial:
|
case kCallbackPartial:
|
||||||
|
@@ -6191,7 +6191,7 @@ static void op_function(const oparg_T *oap)
|
|||||||
finish_op = false;
|
finish_op = false;
|
||||||
|
|
||||||
typval_T rettv;
|
typval_T rettv;
|
||||||
if (callback_call(&opfunc_cb, 1, argv, &rettv) != FAIL) {
|
if (callback_call(&opfunc_cb, 1, argv, &rettv)) {
|
||||||
tv_clear(&rettv);
|
tv_clear(&rettv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -467,7 +467,6 @@ describe('v:lua', function()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
vim.api.nvim_buf_set_option(0, 'omnifunc', 'v:lua.mymod.omni')
|
|
||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -515,6 +514,7 @@ describe('v:lua', function()
|
|||||||
[5] = {bold = true, foreground = Screen.colors.SeaGreen4},
|
[5] = {bold = true, foreground = Screen.colors.SeaGreen4},
|
||||||
})
|
})
|
||||||
screen:attach()
|
screen:attach()
|
||||||
|
meths.buf_set_option(0, 'omnifunc', 'v:lua.mymod.omni')
|
||||||
feed('isome st<c-x><c-o>')
|
feed('isome st<c-x><c-o>')
|
||||||
screen:expect{grid=[[
|
screen:expect{grid=[[
|
||||||
some stuff^ |
|
some stuff^ |
|
||||||
@@ -526,6 +526,9 @@ describe('v:lua', function()
|
|||||||
{1:~ }|
|
{1:~ }|
|
||||||
{4:-- Omni completion (^O^N^P) }{5:match 1 of 3} |
|
{4:-- Omni completion (^O^N^P) }{5:match 1 of 3} |
|
||||||
]]}
|
]]}
|
||||||
|
meths.set_option('operatorfunc', 'v:lua.mymod.noisy')
|
||||||
|
feed('<Esc>g@g@')
|
||||||
|
eq("hey line", meths.get_current_line())
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('supports packages', function()
|
it('supports packages', function()
|
||||||
|
Reference in New Issue
Block a user