Skip to content

fix invalid winid in Popup:_open_window#367

Open
konosubakonoakua wants to merge 1 commit intoMunifTanjim:mainfrom
konosubakonoakua:fix-#357
Open

fix invalid winid in Popup:_open_window#367
konosubakonoakua wants to merge 1 commit intoMunifTanjim:mainfrom
konosubakonoakua:fix-#357

Conversation

@konosubakonoakua
Copy link
Copy Markdown

winid is not nil, not meaning it is valid.

winid is not nil, not meaning it is valid.
@konosubakonoakua
Copy link
Copy Markdown
Author

should fix #357
When I'm using <C-w>o there is chance to trigger #357.

@MunifTanjim
Copy link
Copy Markdown
Owner

When I'm using o there is chance to trigger #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.

autocmd.create("WinClosed", {
group = self._.augroup.hide,
nested = true,
pattern = tostring(self.winid),
callback = function()
self:hide()
end,
}, self.bufnr)

@konosubakonoakua
Copy link
Copy Markdown
Author

When I'm using o there is chance to trigger #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.

autocmd.create("WinClosed", {
group = self._.augroup.hide,
nested = true,
pattern = tostring(self.winid),
callback = function()
self:hide()
end,
}, self.bufnr)

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.

@konosubakonoakua
Copy link
Copy Markdown
Author

found something in neovim repo, not sure related or not.
fix(treesitter): update window if inspected buffer is still open #28922

@MunifTanjim
Copy link
Copy Markdown
Owner

found something in neovim repo, not sure related or not. neovim/neovim#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.

@konosubakonoakua
Copy link
Copy Markdown
Author

konosubakonoakua commented May 23, 2024

found something in neovim repo, not sure related or not. neovim/neovim#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.

...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. 😭

@MunifTanjim
Copy link
Copy Markdown
Owner

First step of solving it would be to find out how to reproduce it consistently.

@brunnseb
Copy link
Copy Markdown

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:

  1. Configure the plugin to use folke/edgy.nvim according to the plugins README (https://github.com/huynle/ogpt.nvim)
  2. Open the chat window by using the OGPT command
  3. Close the chat window (<C-c>)
  4. Try to open the chat window again with command OGPT
  5. Error

If I do Lazy reload ogpt.nvim in between the error does not appear and everything works as expected.

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.

3 participants