Fix bug where styles aren't correctly applied

This commit is contained in:
Iron_E 2020-09-06 13:29:09 -04:00
parent fd2cb3a36f
commit c8ca0582c1
No known key found for this signature in database
GPG Key ID: B0B37DE7EDC2335F
1 changed files with 4 additions and 3 deletions

View File

@ -23,6 +23,7 @@ if not using_hex_or_256 then vim.o.t_Co = 16 end
local PALETTE_ANSI = 3 local PALETTE_ANSI = 3
local PALETTE_256 = 2 local PALETTE_256 = 2
local PALETTE_HEX = 1 local PALETTE_HEX = 1
local NONE = "NONE"
-- Get the color value of a color variable, or "NONE" as a default. -- Get the color value of a color variable, or "NONE" as a default.
local function get(color, index) -- {{{ † local function get(color, index) -- {{{ †
@ -31,7 +32,7 @@ local function get(color, index) -- {{{ †
elseif type(color) == 'string' then elseif type(color) == 'string' then
return color return color
else else
return "NONE" return NONE
end end
end --}}} ‡ end --}}} ‡
@ -82,11 +83,11 @@ local function highlight(highlight_group, attributes) -- {{{ †
else -- The `highlight_group` is uniquely defined. else -- The `highlight_group` is uniquely defined.
colorize(highlight_cmd, attributes) colorize(highlight_cmd, attributes)
local style = attributes.style local style = attributes.style or NONE
if type(style) == 'table' then if type(style) == 'table' then
-- Concat all of the entries together with a comma between before styling. -- Concat all of the entries together with a comma between before styling.
stylize(highlight_cmd, table.concat(style, ','), style.color) stylize(highlight_cmd, table.concat(style, ','), style.color)
elseif style then -- just style the single entry. else -- The style is just a single entry.
stylize(highlight_cmd, style) stylize(highlight_cmd, style)
end end
end end