rbong / vim-flog

A blazingly fast, stunningly beautiful, exceptionally powerful git branch viewer for Vim/Neovim.
750 stars 22 forks source link

v3 WinScrolled autocmd error on non-flog buffer #137

Closed TamaMcGlinn closed 1 month ago

TamaMcGlinn commented 1 month ago

I switched to v3 for testing and ran into this error that appears on every scroll of a non-flog buffer after having opened a flog buffer:

Error detected while processing WinScrolled Autocommands for "1004":                                                                                                                                           
Error executing lua callback: /home/tama/.vim/plugged/vim-flog/lua/flog/highlight.lua:144: Invalid 'hl_group': Expected Lua string                                                                         
stack traceback:                                                                                                                                                                                               
        [C]: in function 'nvim_buf_add_highlight'                                                                                                                                                              
        /home/tama/.vim/plugged/vim-flog/lua/flog/highlight.lua:144: in function </home/tama/.vim/plugged/vim-flog/lua/flog/highlight.lua:36>

or sometimes for 1003 instead of 1004:

Error detected while processing WinScrolled Autocommands for "1003":                                                                                                                                           
Error executing lua callback: /home/tama/.vim/plugged/vim-flog/lua/flog/highlight.lua:133: Invalid 'hl_group': Expected Lua string                                                                         
stack traceback:                                                                                                                                                                                               
        [C]: in function 'nvim_buf_add_highlight'                                                                                                                                                              
        /home/tama/.vim/plugged/vim-flog/lua/flog/highlight.lua:133: in function </home/tama/.vim/plugged/vim-flog/lua/flog/highlight.lua:42>

The repro steps are:

Note that scrolling works fine inside flog buffers, so the fix will be to make that change only apply to those.

rbong commented 1 month ago

I cannot reproduce this and it should already be targeting the Flog window only to account for this. It appears your autocommands may work differently from mine. Can you let me know the output of nvim --version?

I also pushed a fix, can you let me know if that fixes it for you?

TamaMcGlinn commented 1 month ago
$ nvim --version
NVIM v0.11.0-dev-574+g0c2860d9e
Build type: RelWithDebInfo
LuaJIT 2.1.1720049189
Run "nvim -V1 -v" for more info

Unfortunately, that fix commit has no effect on this bug.

rbong commented 1 month ago

I didn't consider opening another buffer in the Flog window, I thought you meant in a different window since some of the Win* autocommands operate on any window in the same tab by default. See if it's fixed after pushing.

TamaMcGlinn commented 1 month ago

It's in a different window. In my repro step 3, I meant in fact :tabopen and then :e somefile. But the bug happens exactly the same, in the same tab / window.

TamaMcGlinn commented 1 month ago

Yes, that works.

rbong commented 1 month ago

Thanks for reporting and testing fixes. I was able to partially repro after some testing, and issue appears to be that WinEnter still has the old buffer loaded after opening.