Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cursor position outside buffer when opening Trouble #151

Closed
anhari opened this issue Jan 11, 2022 · 9 comments · Fixed by #292
Closed

Cursor position outside buffer when opening Trouble #151

anhari opened this issue Jan 11, 2022 · 9 comments · Fixed by #292

Comments

@anhari
Copy link

anhari commented Jan 11, 2022

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
@gmr458
Copy link

gmr458 commented Feb 15, 2022

same error
image

@rickalex21
Copy link

I'm getting the same error.

@cassava
Copy link

cassava commented Nov 16, 2022

I'm also having this error.

@tkolleh
Copy link

tkolleh commented Jan 22, 2023

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

@krims0n32
Copy link

krims0n32 commented Jan 24, 2023

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

@gmr458
Copy link

gmr458 commented Jan 24, 2023

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.

@jjo93sa
Copy link

jjo93sa commented Feb 19, 2023

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?

@rudenkornk
Copy link

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

@JuanferM
Copy link

JuanferM commented Jun 22, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants