fix(picker.actions): don't reuse_win in floating windows (like the picker preview)

This commit is contained in:
Folke Lemaitre 2025-02-04 23:34:54 +01:00
parent 5e3af693bd
commit 4b9ea98007
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -90,8 +90,13 @@ function M.jump(picker, _, action)
-- use an existing window if possible -- use an existing window if possible
if cmd == "buffer" and #items == 1 and picker.opts.jump.reuse_win and buf ~= current_buf then if cmd == "buffer" and #items == 1 and picker.opts.jump.reuse_win and buf ~= current_buf then
win = vim.fn.win_findbuf(buf)[1] or win for _, w in ipairs(vim.fn.win_findbuf(buf)) do
if vim.api.nvim_win_get_config(w).relative == "" then
win = w
vim.api.nvim_set_current_win(win) vim.api.nvim_set_current_win(win)
break
end
end
end end
-- open the first buffer -- open the first buffer