neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 4607807f9fcb83d4e183f6f67e705ffd7f451077
parent 1f551e068f728ff38bd7fdcfa3a6daf362bab9da
Author: Jaehwang Jung <tomtomjhj@gmail.com>
Date:   Sun, 20 Aug 2023 14:17:45 +0900

fix(treesitter): don't update fold if tree is unchanged

Problem:
Folds are opened when the visible range changes even if there are no
modifications to the buffer, e.g, when using zM for the first time. If
the parsed tree was invalid, on_win re-parses and gets empty tree
changes, which triggers fold updates.

Solution:
Don't update folds in on_changedtree if there are no changes.

Diffstat:
Mruntime/lua/vim/treesitter/_fold.lua | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/runtime/lua/vim/treesitter/_fold.lua b/runtime/lua/vim/treesitter/_fold.lua @@ -299,7 +299,9 @@ local function on_changedtree(bufnr, foldinfo, tree_changes) local srow, _, erow = Range.unpack4(change) get_folds_levels(bufnr, foldinfo, srow, erow) end - foldupdate(bufnr) + if #tree_changes > 0 then + foldupdate(bufnr) + end end) end