Tuesday, November 29, 2016

Re: Fold-related bug and pointer to fix

On Wednesday, November 23, 2016 at 4:39:24 AM UTC-6, Efraim Yawitz wrote:
> I had the following problem and I think it is a bug in some fold-related code:
>
> I was trying to use the NarrowRegion plugin to do diffs between two functions in the same file by creating narrowed buffers for each function and calling :diffthis on them.  When I tried to do this using folds, i.e. :.,+2NarrowRegion to create a buffer for a folded-up function which looked like this:
>
> int FuncName() {
> .....folded........
> }
>
> I got everything but the final brace in the narrowed buffer.  Eventually I discovered that this has nothing to do with NarrowRegion, but just a yank such as:
>
> :.,+2y
>
> over a fold gives only the folded lines but not the line after the fold.
>
> A normal command of y2j works just fine and gets the line after the fold. 

I can confirm this looks like a bug, seeing the same behavior in 64-bit Vim 8.0.95 on Windows 7.

It gets worse actually. I tried several yanks from code that looks like this in Vim:

else
{ ---3 lines folded--- }

No comments: