Skip to content

Commit

Permalink
feat(StatusLine): add nonlocal base method
Browse files Browse the repository at this point in the history
  • Loading branch information
rebelot committed Jan 16, 2022
1 parent c96f77b commit 2a3a76f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lua/heirline/statusline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ function StatusLine:new(child)
return new
end

function StatusLine:nonlocal(attr)
return getmetatable(self).__index(self, attr)
end

function StatusLine:eval()
if self.condition and not self:condition() then
return ""
Expand All @@ -65,7 +69,7 @@ function StatusLine:eval()
local stl = {}

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

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

0 comments on commit 2a3a76f

Please sign in to comment.