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
vim.api.nvim_set_hl(0, hl, { default = true, link = d })
end
break
return
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

View File

@ -185,9 +185,17 @@ local function derive(hl: string, hldef: Hldef)
else
vim.api.nvim_set_hl(0, hl, {default = true, link = d })
end
break
return
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
-- Setup a GitSign* highlight by deriving it from other potentially present