[X] I have searched the existing issues of trouble.nvim
[X] I have searched the existing issues of plugins related to this issue
Neovim version (nvim -v)
0.10.0
Operating system/version
Ubuntu 22
Describe the bug
When scrolling though trouble with j/k, the range of the item under the cursor is not always highlighted correctly in the preview.
This seems to happen if two items have the same line number, but different columns. (Update: I also observed this where all items have different line numbers. It only seems to happen to the first item in the list though)
Correct highlight for 2nd item:
Incorrect highlight for 1st item:
Steps To Reproduce
1) nvim -u repro.lua (see below)
2) scroll through list with j/k and observe highlighting in preview=
Expected Behavior
The range of the item under the cursor should be highlighted in the preview
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
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
vim.cmd.edit("repro.lua")
vim.fn.setqflist({
{
bufnr = 0,
lnum = 1,
col = 0,
end_col = 4,
text = "hello",
},
{
bufnr = 0,
lnum = 1,
col = 8,
end_col = 12,
text = "world",
},
})
local ns = vim.api.nvim_create_namespace("repro")
vim.diagnostic.set(ns, 0, {
{
bufnr = 0,
lnum = 1,
col = 0,
end_col = 10,
message = "d1",
},
{
bufnr = 0,
lnum = 1,
col = 12,
end_col = 25,
message = "d2",
},
{
bufnr = 0,
lnum = 5,
col = 1,
end_col = 15,
message = "d3",
},
{
bufnr = 0,
lnum = 5,
col = 16,
end_col = 25,
message = "d4",
},
})
require'trouble'.open({mode = "diagnostics", focus = true})
Did you check docs and existing issues?
Neovim version (nvim -v)
0.10.0
Operating system/version
Ubuntu 22
Describe the bug
When scrolling though trouble with j/k, the range of the item under the cursor is not always highlighted correctly in the preview.
This seems to happen if two items have the same line number, but different columns. (Update: I also observed this where all items have different line numbers. It only seems to happen to the first item in the list though)
Correct highlight for 2nd item:
Incorrect highlight for 1st item:
Steps To Reproduce
1) nvim -u repro.lua (see below) 2) scroll through list with j/k and observe highlighting in preview=
Expected Behavior
The range of the item under the cursor should be highlighted in the preview
Repro