feat(picker.actions): added separate hl group for pick win current

This commit is contained in:
Folke Lemaitre 2025-01-29 06:42:10 +01:00
parent f03a17c48d
commit 9b80e444f5
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 7 additions and 4 deletions

View file

@ -135,7 +135,7 @@ function M.pick_win(picker, item, action)
height = 3,
text = (" \n %s \n "):format(c),
wo = {
winhighlight = "NormalFloat:SnacksPickerPickWin",
winhighlight = "NormalFloat:SnacksPickerPickWin" .. (win == picker.main and "Current" or ""),
},
})
end
@ -145,9 +145,11 @@ function M.pick_win(picker, item, action)
for _, overlay in pairs(overlays) do
overlay:close()
end
local win = overlays[char]
local win = Snacks.util.keycode("<cr>") or overlays[char]
if win then
picker.main = win.opts.win
if type(win) == "table" then
picker.main = win.opts.win
end
vim.defer_fn(function()
if not picker.closed then
picker.layout:unhide()

View file

@ -65,7 +65,8 @@ Snacks.util.set_hl({
GitStatusCopied = "SnacksPickerGitStatus",
GitStatusUntracked = "SnacksPickerGitStatus",
ManSection = "Number",
PickWin = "DiagnosticVirtualTextError",
PickWin = "Search",
PickWinCurrent = "CurSearch",
ManPage = "Special",
-- Icons
Icon = "Special",