Hi Bram!
On Mo, 29 Aug 2016, Bram Moolenaar wrote:
>
> Christian Brabandt wrote:
>
> > I am currently writing some tests for normal.c, to increase the coverage.
> >
> > Unfortunately, I noteiced some bugs with folding: Here is one issue:
> >
> > ~$ vim -u NONE -N
> > call setline(1, range(1,10)
> > :3
> > norm! 2zF
> > :2
> > norm! 5zF
> > :set nofoldenable
> > :3
> > norm! zc -> folds line 2 - 8, I would have expected to only close the inner fold 3-4, but perhaps that is expected, but see below:
> > set nofoldenable
> > norm! Vzc -> correctly folds 3-4
> > :set nofoldenable
> > norm! zc -> folds lines 3-4?
>
> Isn't this because 'foldlevel' keeps the same value when 'foldenable' is
> reset?
But I never messed with the foldlevel setting.
Also, it seems, it is not so easily reproducible, as I initially
thought. Sometimes it happens for me, and sometimes it always folds
lines 2-8 but I never saw that it changes the foldlevel setting
> > Also I got another session, where zF create one additional closing
> > fold marker several lines below where it definitly shouldn't.
> > Unfortunately, I can't reproduce this problem anymore.
>
> The rules for opening a closing folds are a bit complicated...
> It's possible there is a bug, but it's also possible that something is
> missing in the documentation. I notice "zc" doesn't say anything about
> 'foldlevel'.
Adding to the documentation does help, as I only test according to the
documentation and do not read the source. Hm, will have to further
investigate.
Best,
Christian