aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/treesitter/highlighter.lua
diff options
context:
space:
mode:
authorJaehwang Jung <tomtomjhj@gmail.com>2023-09-12 04:29:39 +0900
committerGitHub <noreply@github.com>2023-09-11 12:29:39 -0700
commit65738202f8be3ca63b75197d48f2c7a9324c035b (patch)
treeaf84592f43cac667a06c50d005f726a31492677c /runtime/lua/vim/treesitter/highlighter.lua
parentf859d16aea0d58e572edc9aaf1de3542569e10a9 (diff)
downloadrneovim-65738202f8be3ca63b75197d48f2c7a9324c035b.tar.gz
rneovim-65738202f8be3ca63b75197d48f2c7a9324c035b.tar.bz2
rneovim-65738202f8be3ca63b75197d48f2c7a9324c035b.zip
fix(decorations): better approximation of botline #24794
Problem: * The guessed botline might be smaller than the actual botline e.g. when there are folds and the user is typing in insert mode. This may result in incorrect treesitter highlights for injections. * botline can be larger than the last line number of the buffer, which results in errors when placing extmarks. Solution: * Take a more conservative approximation. I am not sure if it is sufficient to guarantee correctness, but it seems to be good enough for the case mentioned above. * Clamp it to the last line number. Co-authored-by: Lewis Russell <me@lewisr.dev>
Diffstat (limited to 'runtime/lua/vim/treesitter/highlighter.lua')
-rw-r--r--runtime/lua/vim/treesitter/highlighter.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/lua/vim/treesitter/highlighter.lua b/runtime/lua/vim/treesitter/highlighter.lua
index 56b075b723..8d4d6a9337 100644
--- a/runtime/lua/vim/treesitter/highlighter.lua
+++ b/runtime/lua/vim/treesitter/highlighter.lua
@@ -322,7 +322,7 @@ function TSHighlighter._on_win(_, _win, buf, topline, botline)
if not self then
return false
end
- self.tree:parse({ topline, botline })
+ self.tree:parse({ topline, botline + 1 })
self:reset_highlight_state()
self.redraw_count = self.redraw_count + 1
return true