noice.nvim icon indicating copy to clipboard operation
noice.nvim copied to clipboard

bug: calling nvim_win_close for doc will make next open pin at left

Open xzbdmw opened this issue 4 months ago • 0 comments

Did you check docs and existing issues?

  • [X] I have read all the noice.nvim docs
  • [X] I have searched the existing issues of noice.nvim
  • [X] I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

NVIM v0.10.0-dev-6308+ga090d43d6

Operating system/version

macos 14.2

Describe the bug

calling nvim_win_close for doc will make next open pin at left.

https://github.com/folke/noice.nvim/assets/97848247/cea3a540-ccca-4ef5-9061-1dafe1937d3f

Steps To Reproduce

  1. noice config
                hover = {
                    enabled = true,
                    opts = {
                        size = {
                            max_height = 12,
                            max_width = 50,
                        },
                        border = {
                            style = "rounded",
                            padding = { 0, 2 },
                        },
                        position = { row = 2, col = 0 },
                    },
                },
  1. close function
keymap({ "s", "i", "n" }, "<C-7>", function()
    for _, win in pairs(vim.api.nvim_list_wins()) do
        local success, win_config = pcall(vim.api.nvim_win_get_config, win)
        if success then
            if win_config.relative ~= "" then
                vim.api.nvim_win_close(win, true)
            end
        end
    end
end, opts)
  1. using K to hover doc, and <C-7> to close it , and K to hover again

Expected Behavior

the 2 hover have the same effect

Repro

default lazyvim add the keymap binding can reproduce

xzbdmw avatar Feb 17 '24 01:02 xzbdmw