From 781485b4637261d51a8124c937ef0faea650b53e Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 1 Jul 2026 15:52:21 +0200 Subject: implement backwards compatible style handling --- spellcheck.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'spellcheck.lua') 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 -- cgit v1.2.3