diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2026-09-23 09:53:05 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2026-09-23 09:53:05 +0200 |
| commit | dfd0a30d09b8c8647911ae596ec14f3d6ae1ee7e (patch) | |
| tree | a4d2b00b3caf14728e7b7704bc67b5cdc8c8c2b6 /spellcheck.lua | |
| parent | 781485b4637261d51a8124c937ef0faea650b53e (diff) | |
| download | vis-spellcheck-dfd0a30d09b8c8647911ae596ec14f3d6ae1ee7e.tar.gz vis-spellcheck-dfd0a30d09b8c8647911ae596ec14f3d6ae1ee7e.zip | |
clear token cache when toggling syntax aware spellchecking
Diffstat (limited to 'spellcheck.lua')
| -rw-r--r-- | spellcheck.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/spellcheck.lua b/spellcheck.lua index c2f4971..b8d68a0 100644 --- a/spellcheck.lua +++ b/spellcheck.lua @@ -307,6 +307,8 @@ local enable_spellcheck = function() lexer.lex = wrap_lex_func(old_lex_func) -- reset last data to enforce new highlighting last_data = '' + -- clear token cache to relex the window + if vis.win.token_cache then vis.win.token_cache = {} end return end end @@ -335,6 +337,8 @@ local disable_spellcheck = function() local lexer = vis.lexers.load(vis.win.syntax, nil, true) lexer.lex = old_lex_func wrapped_lex_funcs[vis.win] = nil + -- clear token cache to relex the window + if vis.win.token_cache then vis.win.token_cache = {} end else spellcheck.check_full_viewport[vis.win] = nil end @@ -354,8 +358,8 @@ vis:map(vis.modes.NORMAL, '<F7>', function() enable_spellcheck() else disable_spellcheck() - vis.win:draw() end + vis.win:draw() return 0 end, 'Toggle spellchecking in the current window') |
