aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake.deps/deps.txt4
-rw-r--r--runtime/lua/vim/treesitter/_fold.lua10
2 files changed, 12 insertions, 2 deletions
diff --git a/cmake.deps/deps.txt b/cmake.deps/deps.txt
index 4b2424f464..7f060c76ed 100644
--- a/cmake.deps/deps.txt
+++ b/cmake.deps/deps.txt
@@ -4,8 +4,8 @@ LIBUV_SHA256 7aa66be3413ae10605e1f5c9ae934504ffe317ef68ea16fdaa83e23905c681bd
MSGPACK_URL https://github.com/msgpack/msgpack-c/releases/download/c-6.0.0/msgpack-c-6.0.0.tar.gz
MSGPACK_SHA256 3654f5e2c652dc52e0a993e270bb57d5702b262703f03771c152bba51602aeba
-LUAJIT_URL https://github.com/LuaJIT/LuaJIT/archive/03c31124cc3b521ef54fe398e10fa55660a5057d.tar.gz
-LUAJIT_SHA256 61dcc7ae3f543ae3cc30e66db060e31e2a77e4be34ee65e370c953d112b4d60c
+LUAJIT_URL https://github.com/LuaJIT/LuaJIT/archive/83954100dba9fc0cf5eeaf122f007df35ec9a604.tar.gz
+LUAJIT_SHA256 99b47959c953200e865f1d55dcbb19f887b1d6fc92b9d73192114115c62a7ac6
LUA_URL https://www.lua.org/ftp/lua-5.1.5.tar.gz
LUA_SHA256 2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333
diff --git a/runtime/lua/vim/treesitter/_fold.lua b/runtime/lua/vim/treesitter/_fold.lua
index 912a6e8a9f..d82e04a5a8 100644
--- a/runtime/lua/vim/treesitter/_fold.lua
+++ b/runtime/lua/vim/treesitter/_fold.lua
@@ -235,6 +235,8 @@ local M = {}
---@type table<integer,TS.FoldInfo>
local foldinfos = {}
+local group = api.nvim_create_augroup('treesitter/fold', {})
+
--- Update the folds in the windows that contain the buffer and use expr foldmethod (assuming that
--- the user doesn't use different foldexpr for the same buffer).
---
@@ -253,7 +255,15 @@ local function foldupdate(bufnr)
if api.nvim_get_mode().mode == 'i' then
-- foldUpdate() is guarded in insert mode. So update folds on InsertLeave
+ if #(api.nvim_get_autocmds({
+ group = group,
+ buffer = bufnr,
+ })) > 0 then
+ return
+ end
api.nvim_create_autocmd('InsertLeave', {
+ group = group,
+ buffer = bufnr,
once = true,
callback = do_update,
})