Skip to content

Commit 5a5f0e1

Browse files
phanenibhagwan
authored andcommitted
fix(previewer): prefer winopts.winhl (useful with non-float window as previewer)
1 parent 05a4af9 commit 5a5f0e1

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

lua/fzf-lua/types.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,8 @@ _G.FzfLua = require("fzf-lua")
279279
---@field scrolloff? integer
280280

281281
---@class fzf-lua.config.Keymap
282-
---@field builtin table<string, string>
283-
---@field fzf table<string, string>
282+
---@field builtin? table<string, string>
283+
---@field fzf? table<string, string>
284284

285285
---@class fzf-lua.config.Previewer
286286
---@field cmd string|fun():string?

lua/fzf-lua/win.lua

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -519,13 +519,16 @@ end
519519
function FzfWin:reset_win_highlights(win)
520520
-- derive the highlights from the window type
521521
local key = "main"
522+
local hl
522523
if win == self.preview_winid then
523524
key = "prev"
525+
hl = self._previewer:gen_winopts().winhl
524526
end
525-
local hl
526-
for _, h in ipairs(self.winopts.__winhls[key]) do
527-
if h[2] then
528-
hl = string.format("%s%s:%s", hl and hl .. "," or "", h[1], h[2])
527+
if not hl then
528+
for _, h in ipairs(self.winopts.__winhls[key]) do
529+
if h[2] then
530+
hl = string.format("%s%s:%s", hl and hl .. "," or "", h[1], h[2])
531+
end
529532
end
530533
end
531534
utils.wo[win].winhl = hl

0 commit comments

Comments
 (0)