Skip to content

Commit 6827e18

Browse files
ALVAROPING1mehalter
authored andcommitted
fix(heirline): fix some icons not being correctly highlighted
1 parent 525a900 commit 6827e18

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

lua/astroui/status/heirline.lua

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,21 @@ function M.tab_type(self, prefix)
3030
return (prefix or "buffer") .. tab_type
3131
end
3232

33+
local function cached_func(func, ...)
34+
local cached
35+
local args = { ... }
36+
return function(self)
37+
if cached == nil then cached = func(unpack(args)) end
38+
if type(cached) == "function" then return cached(self) end
39+
return cached
40+
end
41+
end
42+
3343
--- Make a list of buffers, rendering each buffer with the provided component
3444
---@param component table
3545
---@return table
3646
function M.make_buflist(component)
37-
local overflow_hl = hl.get_attributes("buffer_overflow", true)
47+
local overflow_hl = cached_func(hl.get_attributes, "buffer_overflow", true)
3848
return require("heirline.utils").make_buflist(
3949
status_utils.surround(
4050
"tab",
@@ -70,7 +80,7 @@ function M.make_buflist(component)
7080
end
7181
end,
7282
provider = function(self) return provider.str { str = self.label, padding = { left = 1, right = 1 } } end,
73-
hl = hl.get_attributes "buffer_picker",
83+
hl = cached_func(hl.get_attributes, "buffer_picker"),
7484
},
7585
component, -- create buffer component
7686
},

0 commit comments

Comments
 (0)