diff options
author | Luuk van Baal <luukvbaal@gmail.com> | 2024-06-23 13:50:21 +0200 |
---|---|---|
committer | Lewis Russell <me@lewisr.dev> | 2024-06-24 09:22:27 +0100 |
commit | da4e8dc5b04a82c6dd483f6c5345a81d8b375bec (patch) | |
tree | a3052097874f60832016b8d6233cdd2d0c07ea36 /runtime/lua/vim/treesitter/highlighter.lua | |
parent | be999e6a0e5b251b2b37500d06636d4167334c6e (diff) | |
download | rneovim-da4e8dc5b04a82c6dd483f6c5345a81d8b375bec.tar.gz rneovim-da4e8dc5b04a82c6dd483f6c5345a81d8b375bec.tar.bz2 rneovim-da4e8dc5b04a82c6dd483f6c5345a81d8b375bec.zip |
fix(treesitter): do not modify highlight state for _on_spell_nav
Problem: Treesitter highlighter clears the already populated highlight
state when performing spell checking while drawing a
smoothscrolled topline.
Solution: Save and restore the highlight state in the highlighter's
_on_spell_nav callback.
Diffstat (limited to 'runtime/lua/vim/treesitter/highlighter.lua')
-rw-r--r-- | runtime/lua/vim/treesitter/highlighter.lua | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/runtime/lua/vim/treesitter/highlighter.lua b/runtime/lua/vim/treesitter/highlighter.lua index 003f7e0169..cd5c67d816 100644 --- a/runtime/lua/vim/treesitter/highlighter.lua +++ b/runtime/lua/vim/treesitter/highlighter.lua @@ -377,11 +377,15 @@ function TSHighlighter._on_spell_nav(_, _, buf, srow, _, erow, _) return end + -- Do not affect potentially populated highlight state. Here we just want a temporary + -- empty state so the C code can detect whether the region should be spell checked. + local highlight_states = self._highlight_states self:prepare_highlight_states(srow, erow) for row = srow, erow do on_line_impl(self, buf, row, true) end + self._highlight_states = highlight_states end ---@private |