aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/treesitter/highlighter.lua
diff options
context:
space:
mode:
authorluukvbaal <luukvbaal@gmail.com>2024-11-17 20:43:36 +0100
committerGitHub <noreply@github.com>2024-11-17 11:43:36 -0800
commit235cb5bc5f2553f5a46807267b8705e53f7a14af (patch)
tree4beefefba9ec3265958aa1979a8a14c0b0b62a00 /runtime/lua/vim/treesitter/highlighter.lua
parente025f5a5b30a1ef92e88fed0f0c548d2240d30c0 (diff)
downloadrneovim-235cb5bc5f2553f5a46807267b8705e53f7a14af.tar.gz
rneovim-235cb5bc5f2553f5a46807267b8705e53f7a14af.tar.bz2
rneovim-235cb5bc5f2553f5a46807267b8705e53f7a14af.zip
fix(api): update "range" windows in nvim__redraw #31042
Problem: nvim__redraw's "range" marks a buffer range for redraw, and subsequently flushes the UI without updating the windows containing that buffer. Solution: Implicitly update the screen, unless specified otherwise. Only update the screen with the last call of the treesitter on_changedtree() callback.
Diffstat (limited to 'runtime/lua/vim/treesitter/highlighter.lua')
-rw-r--r--runtime/lua/vim/treesitter/highlighter.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/runtime/lua/vim/treesitter/highlighter.lua b/runtime/lua/vim/treesitter/highlighter.lua
index 4ad62f4816..05124c29f0 100644
--- a/runtime/lua/vim/treesitter/highlighter.lua
+++ b/runtime/lua/vim/treesitter/highlighter.lua
@@ -219,8 +219,8 @@ end
---@package
---@param changes Range6[]
function TSHighlighter:on_changedtree(changes)
- for _, ch in ipairs(changes) do
- api.nvim__redraw({ buf = self.bufnr, range = { ch[1], ch[4] + 1 } })
+ for i, ch in ipairs(changes) do
+ api.nvim__redraw({ buf = self.bufnr, range = { ch[1], ch[4] + 1 }, flush = i == #changes })
end
end