diff options
author | Lewis Russell <lewis6991@gmail.com> | 2022-04-29 17:26:57 +0100 |
---|---|---|
committer | Lewis Russell <lewis6991@gmail.com> | 2022-05-17 10:29:33 +0100 |
commit | 5c41165c8e89356bdb7d1b5835d1f79725b62d2c (patch) | |
tree | 1417c52d442a0091f3b29833d0d75210ad9e87ae /src/nvim/lua/executor.c | |
parent | 6613f58cebde7db4e69709b84d511c32a7c4ce32 (diff) | |
download | rneovim-5c41165c8e89356bdb7d1b5835d1f79725b62d2c.tar.gz rneovim-5c41165c8e89356bdb7d1b5835d1f79725b62d2c.tar.bz2 rneovim-5c41165c8e89356bdb7d1b5835d1f79725b62d2c.zip |
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.
Diffstat (limited to 'src/nvim/lua/executor.c')
-rw-r--r-- | src/nvim/lua/executor.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 9758cee0a5..c2d76e3ce8 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -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"); } |