Xavier de Gaye wrote:

> I use loadview and mkview with autocommands. It happens quite often
> that upon returning to a buffer, a fold becomes unexpectedly closed.
> In that case, whatever fold I attempt to open in this buffer next, it
> will be closed after I leave the buffer and on returning to it again.
> 
> Attached are a test case and a patch.
> 
> To run the test case:
>    * vim -u NONE foo.py
>    * run:
>        :source test.vim
>        :mkview
>        :loadview
>    * the bug shows up after 'loadview': the second fold becomes
>      unexpectedly closed
> 
> After the test, the view file contains the following lines:
>    2
>    normal zo
>    3
>    normal zc
>    7
>    normal zo
>    2
>    normal zo
> 
> Note that at line 3, 'zc' will close the parent fold and not the first
> nested fold since this one is already closed, so that the following
> 'zo' at line 7 instead of opening the second nested fold, does reopen
> again the parent fold.
> 
> The patch fixes the problem by never closing a leaf fold (since they
> are already closed) and not reopening a parent fold after its leaves
> have been taken care of, when it is an open fold (since it is already
> open, reopening the parent fold was unfortunately hiding the bug).

Thanks for the patch.  I'll look into it later.  I'll use the second
patch you sent.

-- 
A computer program does what you tell it to do, not what you want it to do.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui