aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/lua')
-rw-r--r--src/nvim/lua/base64.c5
-rw-r--r--src/nvim/lua/executor.c12
-rw-r--r--src/nvim/lua/stdlib.c2
-rw-r--r--src/nvim/lua/xdiff.c1
4 files changed, 13 insertions, 7 deletions
diff --git a/src/nvim/lua/base64.c b/src/nvim/lua/base64.c
index 3f246839d5..c1f43a37d7 100644
--- a/src/nvim/lua/base64.c
+++ b/src/nvim/lua/base64.c
@@ -1,11 +1,16 @@
#include <assert.h>
#include <lauxlib.h>
#include <lua.h>
+#include <stddef.h>
#include "nvim/base64.h"
#include "nvim/lua/base64.h"
#include "nvim/memory.h"
+#ifdef INCLUDE_GENERATED_DECLARATIONS
+# include "lua/base64.c.generated.h"
+#endif
+
static int nlua_base64_encode(lua_State *L)
{
if (lua_gettop(L) < 1) {
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c
index aed96a539a..12304b6f11 100644
--- a/src/nvim/lua/executor.c
+++ b/src/nvim/lua/executor.c
@@ -366,17 +366,17 @@ static void nlua_schedule_event(void **argv)
static int nlua_schedule(lua_State *const lstate)
FUNC_ATTR_NONNULL_ALL
{
- // If Nvim is exiting don't schedule tasks to run in the future. Any refs
- // allocated here will not be cleaned up otherwise
- if (exiting) {
- return 0;
- }
-
if (lua_type(lstate, 1) != LUA_TFUNCTION) {
lua_pushliteral(lstate, "vim.schedule: expected function");
return lua_error(lstate);
}
+ // If main_loop is closing don't schedule tasks to run in the future,
+ // otherwise any refs allocated here will not be cleaned up.
+ if (main_loop.closing) {
+ return 0;
+ }
+
LuaRef cb = nlua_ref_global(lstate, 1);
multiqueue_put(main_loop.events, nlua_schedule_event,
diff --git a/src/nvim/lua/stdlib.c b/src/nvim/lua/stdlib.c
index 5072d14c0e..a200b0a32f 100644
--- a/src/nvim/lua/stdlib.c
+++ b/src/nvim/lua/stdlib.c
@@ -224,7 +224,7 @@ static int nlua_str_utf_start(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
if (offset < 0 || offset > (intptr_t)s1_len) {
return luaL_error(lstate, "index out of range");
}
- int head_offset = utf_cp_head_off(s1, s1 + offset - 1);
+ int head_offset = -utf_cp_head_off(s1, s1 + offset - 1);
lua_pushinteger(lstate, head_offset);
return 1;
}
diff --git a/src/nvim/lua/xdiff.c b/src/nvim/lua/xdiff.c
index f3f78b79f5..29e3bbefd0 100644
--- a/src/nvim/lua/xdiff.c
+++ b/src/nvim/lua/xdiff.c
@@ -13,6 +13,7 @@
#include "nvim/lua/xdiff.h"
#include "nvim/macros.h"
#include "nvim/memory.h"
+#include "nvim/pos.h"
#include "nvim/vim.h"
#include "xdiff/xdiff.h"