diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2019-08-04 21:56:29 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2019-08-05 13:57:24 +0200 |
commit | 88938634e7418ced4cfb074c48867523460dcc84 (patch) | |
tree | 337a13b6d292efd115856e40ed6e0f935736b59a /src/nvim/lua/executor.c | |
parent | e6d77993d1167f4c15c9f67c0c3281444b1d18c2 (diff) | |
download | rneovim-88938634e7418ced4cfb074c48867523460dcc84.tar.gz rneovim-88938634e7418ced4cfb074c48867523460dcc84.tar.bz2 rneovim-88938634e7418ced4cfb074c48867523460dcc84.zip |
lua: add vim.in_fast_event() to check if we are in a luv callback
Diffstat (limited to 'src/nvim/lua/executor.c')
-rw-r--r-- | src/nvim/lua/executor.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 1f2651e243..4051354d65 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -223,6 +223,9 @@ static int nlua_state_init(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL // schedule lua_pushcfunction(lstate, &nlua_schedule); lua_setfield(lstate, -2, "schedule"); + // in_fast_event + lua_pushcfunction(lstate, &nlua_in_fast_event); + lua_setfield(lstate, -2, "in_fast_event"); // vim.loop luv_set_loop(lstate, &main_loop.uv); @@ -457,6 +460,12 @@ int nlua_debug(lua_State *lstate) return 0; } +int nlua_in_fast_event(lua_State *lstate) +{ + lua_pushboolean(lstate, in_fast_callback > 0); + return 1; +} + #ifdef WIN32 /// os.getenv: override os.getenv to maintain coherency. #9681 /// |