mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 20:08:17 +00:00
feat(lua): allow some viml functions to run in fast
This change adds the necessary plumbing to annotate functions in funcs.c as being allowed in run in luv fast events.
This commit is contained in:
@@ -916,12 +916,22 @@ int nlua_in_fast_event(lua_State *lstate)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static bool viml_func_is_fast(const char *name)
|
||||
{
|
||||
const EvalFuncDef *const fdef = find_internal_func((const char *)name);
|
||||
if (fdef) {
|
||||
return fdef->fast;
|
||||
}
|
||||
// Not a vimL function
|
||||
return false;
|
||||
}
|
||||
|
||||
int nlua_call(lua_State *lstate)
|
||||
{
|
||||
Error err = ERROR_INIT;
|
||||
size_t name_len;
|
||||
const char *name = luaL_checklstring(lstate, 1, &name_len);
|
||||
if (!nlua_is_deferred_safe()) {
|
||||
if (!nlua_is_deferred_safe() && !viml_func_is_fast(name)) {
|
||||
return luaL_error(lstate, e_luv_api_disabled, "vimL function");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user