15498Re: Fold expr problem when last line is deleted
- Oct 2, 2000David Bustos wrote:
> I noticed that when I have my fold method set to an expression and IYes, something goes wrong here.
> delete the last or next to last line in a buffer, vim thinks that the
> new last line is no longer in a fold, when it should be. For example:
> line 1
> line 2
> line 3
> :set foldexpr=(v:lnum==1)?1:'=' " One fold from the top to the bottom
> :set foldmethod=expr
> G dd zc
> vim will inform you that there is no fold there, where clearly there
> should be.
> After snooping around a bit, I found a fix for fold.c. However, I'mHmm, I would say the computation of the level is already wrong. It returns
> having difficulty following the code there and am not sure if this is
> the best solution. Here it goes:
"0" for the last line, which it should be "-1". After correcting that it no
longer runs into the problem of deleting the fold for the last line.
However, the fold includes lines that don't exist...
There is another error in calling the fold update function with the wrong
arguments. I'll look into that...
OK, it seems to work well now. You'll see it in the next release...
In a world without fences, who needs Gates and Windows?
/// Bram Moolenaar Bram@... http://www.moolenaar.net \\\
\\\ Vim: http://www.vim.org ICCF Holland: http://iccf-holland.org ///
- << Previous post in topic