Skip to content

Commit

Permalink
fix(functions): handle highlights of winbar result with prefixed zeros
Browse files Browse the repository at this point in the history
This should avoid errors as reported on issue
[#339](#339 (comment))
  • Loading branch information
kevinm6 authored and NTBBloodbath committed Mar 26, 2024
1 parent 5300ae0 commit 1bad966
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lua/rest-nvim/result/winbar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ local function get_hl_group_fg(name)
-- If the HEX color has a zero as the first character, `string.format` will skip it
-- so we have to add it manually later
local hl_fg = string.format("%02X", vim.api.nvim_get_hl(0, { name = name, link = false }).fg)
if #hl_fg == 5 then
if #hl_fg == 4 then
hl_fg = "00" .. hl_fg
elseif #hl_fg == 5 then
hl_fg = "0" .. hl_fg
end
hl_fg = "#" .. hl_fg
Expand Down

0 comments on commit 1bad966

Please sign in to comment.