aboutsummaryrefslogtreecommitdiff
path: root/spellcheck.lua
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2026-07-01 15:52:21 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2026-07-01 15:52:21 +0200
commit781485b4637261d51a8124c937ef0faea650b53e (patch)
treee76d736efea62e6bc6a70f44ba89fd5d6c81635c /spellcheck.lua
parent8072920019d35ab54bc5d2096a7337cda2799422 (diff)
downloadvis-spellcheck-781485b4637261d51a8124c937ef0faea650b53e.tar.gz
vis-spellcheck-781485b4637261d51a8124c937ef0faea650b53e.zip
implement backwards compatible style handling
Diffstat (limited to 'spellcheck.lua')
-rw-r--r--spellcheck.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/spellcheck.lua b/spellcheck.lua
index 4a2a9df..c2f4971 100644
--- a/spellcheck.lua
+++ b/spellcheck.lua
@@ -39,11 +39,19 @@ else
return nil
end
-spellcheck.typo_style_id = 42
+spellcheck.typo_style_id = vis.API > 3215 and vis.ui:style_push() or 42
spellcheck.typo_style = 'fore:red'
spellcheck.check_full_viewport = {}
spellcheck.disable_syntax_awareness = false
+local function style_define(id, style)
+ if vis.API and vis.API > 3215 then
+ return vis.ui:style_define(id, style)
+ else
+ return vis.win:style_define(id, style)
+ end
+end
+
-- Only use tokens for spellchecking if they are available.
-- If vis is used in setups without lua-lpeg the lexer tokens are not available.
if vis.lexers then