Bekaboo / dropbar.nvim

IDE-like breadcrumbs, out of the box
GNU General Public License v3.0
896 stars 17 forks source link

fix(event): avoid iterating when table is not exist #136

Closed ofseed closed 5 months ago

ofseed commented 5 months ago

Seems quite impossible, but the window may not exist when WinSized is triggered. I don't know the reason but I think avoiding this situation is acceptable.

In my case, this may be because of the plugin: https://github.com/mikesmithgh/kitty-scrollback.nvim/blob/fd75b297d82e6fb5fe724373cd95d2422b31d7b9/lua/kitty-scrollback/autocommands.lua#L55-L82

Bekaboo commented 5 months ago

Thanks for the PR! Could you provide a minimal repro where vim.v.event.windows is not set on WinResized event?

ofseed commented 5 months ago

It's a little difficult to find the minimal code snippet to reproduce it because kitty-scrollback needs a special method to launch. But I'm curious about it. I will figure out the reason when I'm free.

willothy commented 5 months ago

I think that if this is the case it likely should be addressed in kitty-scrollback.nvim, or is an upstream Neovim issue and should be dealt with there - vvars should always be set in autocmd handlers...

Bekaboo commented 5 months ago

@willothy Exactly, we should report this to neovim if vvars is not set.

ofseed commented 5 months ago

Far simpler than I thought... https://github.com/mikesmithgh/kitty-scrollback.nvim/blob/12f7687ac049d46a987c39b2b4f657fdf540fa4e/lua/kitty-scrollback/windows.lua#L134 It's just :doautocmd WinResized manually, so vim.v.event.windows is nil, not an upstream issue. Need to be fixed here, or ask its author not to rely on this?