fix(highlight): apply fallback even if not defined

Fixes: #729
This commit is contained in:
Lewis Russell 2023-01-27 12:55:24 +00:00 committed by Lewis Russell
parent c52162b7b3
commit 0d4fe37ba5
2 changed files with 18 additions and 2 deletions

View File

@ -185,9 +185,17 @@ local function derive(hl, hldef)
else else
vim.api.nvim_set_hl(0, hl, { default = true, link = d }) vim.api.nvim_set_hl(0, hl, { default = true, link = d })
end end
break return
end end
end end
if hldef[1] and not hldef.bg_factor and not hldef.fg_factor then
dprintf('Deriving %s from %s', hl, hldef[1])
vim.api.nvim_set_hl(0, hl, { default = true, link = hldef[1] })
else
dprintf('Could not derive %s', hl)
end
end end

View File

@ -185,9 +185,17 @@ local function derive(hl: string, hldef: Hldef)
else else
vim.api.nvim_set_hl(0, hl, {default = true, link = d }) vim.api.nvim_set_hl(0, hl, {default = true, link = d })
end end
break return
end end
end end
if hldef[1] and not hldef.bg_factor and not hldef.fg_factor then
-- No fallback found which is set. Just link to the first fallback
-- if there are no modifiers
dprintf('Deriving %s from %s', hl, hldef[1])
vim.api.nvim_set_hl(0, hl, {default = true, link = hldef[1] })
else
dprintf('Could not derive %s', hl)
end
end end
-- Setup a GitSign* highlight by deriving it from other potentially present -- Setup a GitSign* highlight by deriving it from other potentially present