nui.nvim
nui.nvim copied to clipboard
fix invalid winid in Popup:_open_window
winid is not nil, not meaning it is valid.
should fix #357
When I'm using <C-w>o there is chance to trigger #357.
When I'm using <C-w>o there is chance to trigger https://github.com/MunifTanjim/nui.nvim/issues/357
Can you give me an example where this could happen? 🤔
There is a WinClosed callback where self.winid is set to nil when window is closed. https://github.com/MunifTanjim/nui.nvim/blob/a3597dc88b53489d3fddbddbbd13787355253bb0/lua/nui/popup/init.lua#L233-L240
When I'm using o there is chance to trigger #357
Can you give me an example where this could happen? 🤔
There is a
WinClosedcallback whereself.winidis set tonilwhen window is closed.https://github.com/MunifTanjim/nui.nvim/blob/a3597dc88b53489d3fddbddbbd13787355253bb0/lua/nui/popup/init.lua#L233-L240
It's hard to tell, mostly with neotree open and several horizontal windows, after <C-w>o or <C-w>c there is a chance to happen, not everytime, the only debug info is invalid window error from nui.nvim. 🤕
Maybe the win is close by some other plugins.
I'm wondering if we can produce a intentional invalid winid which is not nil.
found something in neovim repo, not sure related or not. fix(treesitter): update window if inspected buffer is still open #28922
found something in neovim repo, not sure related or not. https://github.com/neovim/neovim/pull/28922/
I don't think that's related to nui.nvim at all.
the only debug info is invalid window error from nui.nvim
Can you post that here? or maybe a recording? so that I can understand the issue better.
found something in neovim repo, not sure related or not. neovim/neovim#28922
I don't think that's related to
nui.nvimat all.the only debug info is invalid window error from nui.nvim
Can you post that here? or maybe a recording? so that I can understand the issue better.
...x/.local/share/nvim/lazy/nui.nvim/lua/nui/popup/init.lua:168: Invalid window id: 1173
I just triggered this issue with this patch, this pr is not working. 😭
First step of solving it would be to find out how to reproduce it consistently.
I don't really have the time currently to further investigate why it's happening, but here is a way to consistently reproduce the issue using the huynle/ogpt.nvim plugin:
- Configure the plugin to use
folke/edgy.nvimaccording to the plugins README (https://github.com/huynle/ogpt.nvim) - Open the chat window by using the
OGPTcommand - Close the chat window (
<C-c>) - Try to open the chat window again with command
OGPT - Error
If I do Lazy reload ogpt.nvim in between the error does not appear and everything works as expected.