Skip to content

Commit

Permalink
fix(hl): handle nil return of hl function
Browse files Browse the repository at this point in the history
refactor(hl): more elegant handle of `force` kw
  • Loading branch information
rebelot committed Jan 12, 2022
1 parent 6983be1 commit 7a46e28
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/heirline/statusline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ function StatusLine:eval()

local stl = {}

local hl = type(self.hl) == "function" and self:hl() or self.hl -- self raw hl
local hl = type(self.hl) == "function" and (self:hl() or {}) or self.hl -- self raw hl
local cur_hl = getmetatable(self).__index(self, "cur_hl") -- the parent hl

if cur_hl.force then
self.cur_hl = vim.tbl_extend("force", hl, cur_hl) -- merged hl
self.cur_hl = vim.tbl_extend("keep", cur_hl, hl) -- merged hl
else
self.cur_hl = vim.tbl_extend("force", cur_hl, hl) -- merged hl
end
Expand Down

0 comments on commit 7a46e28

Please sign in to comment.