MunifTanjim / nui.nvim

UI Component Library for Neovim.
MIT License
1.62k stars 57 forks source link

fix(split): manual doautocmd BufWinEnter for splits #332

Closed pysan3 closed 8 months ago

pysan3 commented 8 months ago

reference: https://github.com/MunifTanjim/nui.nvim/pull/197

The exact same thing (multiple hidden splits point to the same bufnr) can happen to NuiSplit as well.

I get the error message: `Invalid 'group': 'nuihide'` when I try to split:show().

Hope this gets merged as soon as possible :)

Thanks in advance.


   Error  Error executing vim.schedule lua callback: /path/to/nui/split/init.lua:180: BufWinEnter Autocommands for "<buffer=10>": Vim(append):Error executing lua callback: /path/to/nui/split/init.lua:240: Invalid 'group': 'nui_2_hide'
stack traceback:
    [C]: in function 'create'
    /path/to/nui/split/init.lua:240: in function </path/to/nui/split/init.lua:234>
    [C]: in function 'nvim_win_set_buf'
    /path/to/nui/split/init.lua:180: in function '_open_window'
    /path/to/nui/split/init.lua:288: in function 'show'
    ...neo-tree.nvim/lua/neo-tree/manager/init.lua:349: in function 'create_win'
    ...neo-tree.nvim/lua/neo-tree/manager/init.lua:174: in function 'open_state'
    ...neo-tree.nvim/lua/neo-tree/manager/init.lua:149: in function 'navigate'
    ...neo-tree.nvim/lua/neo-tree/command/init.lua:59: in function <...neo-tree.nvim/lua/neo-tree/command/init.lua:58>
stack traceback:
    [C]: in function 'nvim_win_set_buf'
    /path/to/nui/split/init.lua:180: in function '_open_window'
    /path/to/nui/split/init.lua:288: in function 'show'
    ...neo-tree.nvim/lua/neo-tree/manager/init.lua:349: in function 'create_win'
    ...neo-tree.nvim/lua/neo-tree/manager/init.lua:174: in function 'open_state'
    ...neo-tree.nvim/lua/neo-tree/manager/init.lua:149: in function 'navigate'
    ...neo-tree.nvim/lua/neo-tree/command/init.lua:59: in function <...neo-tree.nvim/lua/neo-tree/command/init.lua:58>
MunifTanjim commented 8 months ago

Looks like this is breaking multiple tests.

You can run the tests locally using: ./scripts/test.sh

pysan3 commented 8 months ago

I see those tests failing even without my changes, so I doubt those failures are on me.

Besides, 78 tests for nui.split do pass, which is the only file I changed, and I don't think my change will affect other files.

pysan3 commented 8 months ago

Hmm, I only get test errors on nvim-nightly, and a nightly that's published at least within a week. Nvim-stable works as well.

Working nvim version.

Not working nvim version.

pysan3 commented 8 months ago

Can you reproduce the error with the very latest nvim-nightly @MunifTanjim ?

pysan3 commented 8 months ago

Seems like this is the PR that should've made things easier, but now backfiring your carefully crafted test suites. I'm not sure tho.

pysan3 commented 8 months ago

Fix proposed at https://github.com/MunifTanjim/nui.nvim/pull/333

Could you check it out @MunifTanjim ?

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (e561ac5) 99.04% compared to head (4f6b07e) 99.04%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #332 +/- ## ======================================= Coverage 99.04% 99.04% ======================================= Files 20 20 Lines 2725 2726 +1 ======================================= + Hits 2699 2700 +1 Misses 26 26 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

MunifTanjim commented 8 months ago

Thanks for the fix 🚀

pysan3 commented 8 months ago

Glad to see the ✅ again :)

Thanks!