Skip to content

fix: invalid window id for popup info window #3147

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yavorski
Copy link

Hi, this solves an error when the info window is closed via fclose - vim.cmd("fclose"). I have this in a keymap bind to ESC and get this error:

x Error  12:13:38 msg_show.lua_error Error detected while processing CursorMoved Autocommands for "*":
Error executing lua callback: .../nvim-tree.lua/lua/nvim-tree/actions/node/file-popup.lua:60: Invalid window id: 1004
stack traceback:
[C]: in function 'nvim_win_close'
.../nvim-tree.lua/lua/nvim-tree/actions/node/file-popup.lua:60: in function <.../nvim-tree.lua/lua/nvim-tree/actions/node/file-popup.lua:58>

The fix is to check if window id is still valid.

Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great find @yavorski !

Works as intended, however the autocommand still remains. You can see this via:
:au NvimTreeRemoveFilePopup

Suggestion: wrap the nvim_win_is_valid check only around the nvim_win_close

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 this pull request may close these issues.

2 participants