`WinScrolled` event close automatically open folds when scrolling
Describe the bug
The commit 4ceee25 seems to have introduce a bug with fold under specific conditions because of the added WinScrolled event.
To Reproduce
- Open a relative long buffer with the following modeline,
# vim: foldmethod=marker foldlevel=0 - Reveal all folds (
zR) - Scroll down the buffer to trigger the
WinScrolledevent - The folds are automatically closed
- Remove the new autocmd:
:autocmd! hlchunk_indent User WinScrolledY, and repeat step 2 and 3 - The folds are untouched
It seems only hlchunk_indent produce this behaviour. Also, when no modeline is used, this work fine :man_shrugging:
I have the same problem.
Did you find a fix yet? @soifou
A workaround is to disable the autocmd after setup:
config = function(_, opts)
require('hlchunk').setup(opts)
local autocmds = vim.api.nvim_get_autocmds({
group = 'hlchunk_indent',
event = 'User',
pattern = 'WinScrolledY',
})
if #autocmds then
vim.api.nvim_del_autocmd(autocmds[1].id)
end
end
But then of course sometimes the indent guides aren't rendered after opening folds.
I pushed a possible fix at https://github.com/shellRaining/hlchunk.nvim/pull/169, can you test if it solves the problem for you too @soifou @tamton-aquib? 🙇
edit: gave up on this, see https://github.com/shellRaining/hlchunk.nvim/pull/169#issuecomment-2930877385