diff options
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') |
