Skip to content

Commit

Permalink
fix: fzf err when hlgroups attrs are set as fg/bg=fg/bg (#976)
Browse files Browse the repository at this point in the history
Bug:    Some colorschemes (e.g. the builtin colorscheme 'torte') set
        fg/bg=fg/bg for hlgroups. If we pass --color=fg:fg to fzf, it
        will make fzf to exit immediately.
Fix:    Detect this in function `utils.hexcol_from_hl()`
  • Loading branch information
bekaboo authored and ibhagwan committed Dec 31, 2023
1 parent 4a970b4 commit 4f2ba97
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lua/fzf-lua/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,12 @@ function M.hexcol_from_hl(hlgroup, what)
if col then
-- format as 6 digit hex for hex2rgb()
hexcol = ("#%06x"):format(col)
else
-- some colorschemes set fg=fg/bg or bg=fg/bg which have no value
-- in the colormap, in this case reset `hexcol` to prevent fzf to
-- err with "invalid color specification: bg:bg" (#976)
-- TODO: should we extract `fg|bg` from `Normal` hlgroup?
hexcol = ""
end
end
return hexcol
Expand Down

0 comments on commit 4f2ba97

Please sign in to comment.