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

Cursor position outside buffer when opening Trouble

Open anhari opened this issue 3 years ago • 2 comments

Description

Run into this issue when opening with :Trouble or navigating to the trouble window after it's been opened:

|| Error executing vim.schedule lua callback: ...site/pack/packer/start/trouble.nvim/lua/trouble/view.lua:453: Cursor position outside buffer
|| stack traceback:
|| 	[C]: in function 'nvim_win_set_cursor'
|| 	...site/pack/packer/start/trouble.nvim/lua/trouble/view.lua:453: in function ''
|| 	vim.lua: in function <vim.lua:0>

Environment details

Trouble config:

  require("trouble").setup {
    auto_open = true,
    auto_close = true
  }

Neovim version info:

NVIM v0.7.0-dev+836-g55a59e56e
Build type: Release
LuaJIT 2.1.0-beta3

anhari avatar Jan 11 '22 18:01 anhari

same error image

gmr458 avatar Feb 15 '22 02:02 gmr458

I'm getting the same error.

rickalex21 avatar Jun 06 '22 18:06 rickalex21

I'm also having this error.

cassava avatar Nov 16 '22 14:11 cassava

Any luck finding a root cause of this issue? Getting this when I open trouble on a Scala file with nvim-metals attached.

tkolleh avatar Jan 22 '23 00:01 tkolleh

~Also having this issue.~

edit: error on my part, the path to the file with diagnostic errors was incorrect due to an error in the linters’ configuration

krims0n32 avatar Jan 24 '23 19:01 krims0n32

I experienced this error in February 2022, I remember that a day later it disappeared. The only advice I can give is to look at the README, maybe you have to update some configuration, update the plugin, I don't know if the version of Neovim you are using has something to do with it.

gmr458 avatar Jan 24 '23 20:01 gmr458

I'm seeing this too:

Error executing vim.schedule lua callback: ...site/pack/packer/start/trouble.nvim/lua/trouble/view.lua:469: Cursor position outside buffer
stack traceback:
        [C]: in function 'nvim_win_set_cursor'
        ...site/pack/packer/start/trouble.nvim/lua/trouble/view.lua:469: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

Running the latest Neovim from HomeBrew: neovim--0.8.3.arm64_ventura.bottle.tar.gz. I've also checked I'm running the latest versions of all the plugins... Does anyone have an idea what this might be?

jjo93sa avatar Feb 19 '23 15:02 jjo93sa

Same issue, trouble version "67337644e38144b444d026b0df2dc5fa0038930f", neovim version:

NVIM v0.8.3
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by runner@fv-az183-550

Features: +acl +iconv +tui

rudenkornk avatar Mar 04 '23 13:03 rudenkornk

I was able to reproduce this on neovim (NVIM v0.9.1). Before calling line 488 (view.lua), I just checked if the corresponding index is not out of bounds.

Line 488 :

vim.api.nvim_win_set_cursor(self.parent, { item.start.line + 1, item.start.character })

was changed to :

if vim.api.nvim_buf_line_count(item.bufnr) > item.start.line + 1 then
    vim.api.nvim_win_set_cursor(self.parent, { item.start.line + 1, item.start.character })
end

Trouble seems to work fine after the changes and the issue is solved.

JuanferM avatar Jun 22 '23 23:06 JuanferM