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 quickfix takes ghostly control of cursor #336

Closed Amleto closed 10 months ago

Amleto commented 10 months ago

Did you check docs and existing issues?

Neovim version (nvim -v)

0.9.2

Operating system/version

win10 22h2

Describe the bug

executing trouble.open("quickfix") and putting the cursor under the trouble group results in the cursor moving by itself. It moves one column at a time to the right until it reaches the end of the line, then it goes to the next line, starting at the first column. This repeats until it reaches the last column of the last line.

Additionally the theme is broken and the main buffer is replaced with a second trouble buffer. From this, image

To this, image

Steps To Reproduce

  1. install cmake and put on PATH
  2. install clang/clangd and put on PATH
  3. clone the c++ test repo (gist)
  4. In the test repo run nvim -u repo.lua
  5. :CMakeSelectConfigurePreset - choose default
  6. :CMakeGenerate
  7. :CMakeBuild (choose ALL_BUILD if necessary)

There should be build errors - check with :cope, then close them :ccl

  1. :lua require'trouble'.open'quickfix'
  2. <CR> to ignore the missing web-devicons warning
  3. Watch the cursor take control of itself.

Expected Behavior

The trouble quickfix buffer should open, the cursor should not go crazy, and the already-open buffer should not have its content replaced.

Repro

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/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", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  "folke/trouble.nvim",
  -- add any other plugins here
  {
    "Civitasv/cmake-tools.nvim",
    dependencies ={"nvim-lua/plenary.nvim"},
  }
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
Amleto commented 10 months ago

https://github.com/folke/trouble.nvim/assets/2996796/2f6e8c52-6e8e-43ea-be52-a30a7a93c4c1

screen recording of the phenomenon

YodaEmbedding commented 10 months ago

See also:


The common thing in all the screen captures is when it says [1, 1]. My guess is that this happens whenever there's no exact line number or position associated with a given error, and then Trouble fills in a default value of [1, 1].

trouble

The troublesome line is marked as "BAD". When the cursor is hovered over it, everything goes haywire and the cursor starts moving right all on its own.

Amleto commented 10 months ago

Thanks @YodaEmbedding for highlighting previous reports, and thanks @folke for the plug-in and the fix