folke / trouble.nvim

🚦 A pretty diagnostics, references, telescope results, quickfix and location list to help you solve all the trouble your code is causing.
Apache License 2.0
5.24k stars 178 forks source link

bug: Trouble does not return focus to floating windows. #335

Closed austin-ray closed 2 months ago

austin-ray commented 10 months ago

Did you check docs and existing issues?

Neovim version (nvim -v)

NVIM v0.10.0-dev-1183+gc68c121f5-dirty (happens on nvim 0.8 and 0.9 too)

Operating system/version

Gentoo Linux

Describe the bug

If the user's focus is on a floating window when invoking :Trouble then :TroubleClose or using auto_open then the cursor will be placed in a non-floating window, not the original floating location.

Steps To Reproduce

Generic:

  1. Open file.
  2. Open a floating window.
  3. Open Trouble with either :Trouble or auto_open.
  4. Cursor is in the file buffer.

Using the below repro:

  1. nvim -u repro.lua
  2. :Lazy update
  3. :Trouble
  4. :TroubleClose
  5. Cursor is in the file buffer when it should be in the Lazy pop-up

Expected Behavior

Cursor will be placed back in the floating window in the correct position.

Repro

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    "--branch=stable", -- latest stable release
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
  {
    "folke/trouble.nvim",
    dependencies = { "nvim-tree/nvim-web-devicons" },
    config = true,
  },
}, {})