Skip to content

Commit 1bad966

Browse files
kevinm6NTBBloodbath
authored andcommitted
fix(functions): handle highlights of winbar result with prefixed zeros
This should avoid errors as reported on issue [#339](#339 (comment))
1 parent 5300ae0 commit 1bad966

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lua/rest-nvim/result/winbar.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ local function get_hl_group_fg(name)
6262
-- If the HEX color has a zero as the first character, `string.format` will skip it
6363
-- so we have to add it manually later
6464
local hl_fg = string.format("%02X", vim.api.nvim_get_hl(0, { name = name, link = false }).fg)
65-
if #hl_fg == 5 then
65+
if #hl_fg == 4 then
66+
hl_fg = "00" .. hl_fg
67+
elseif #hl_fg == 5 then
6668
hl_fg = "0" .. hl_fg
6769
end
6870
hl_fg = "#" .. hl_fg

0 commit comments

Comments
 (0)