[patch] Close folds when entering diff mode, fix problems of patch 7.2.356

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[patch] Close folds when entering diff mode, fix problems of patch 7.2.356

Lech Lorens
The attached patch fixes the problems with patch 7.2.356 (by actually
reverting the patch) which caused the folds to be closed in too many
situations.
Changes:
- in case of 'foldmethod' change the folds are closed only if 'fdm' is
  changed to 'diff',
- folds are closed when one of the following commands is used:
  :diffsplit, :diffthis, :diffpatch.

To decrease the likelihood of undesired side effects the code handling
the normal zM command has been reused.

My apologies for the problems introduced by 7.2.356.

--
Cheers,
Lech

--
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php

close-diff-folds.patch (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [patch] Close folds when entering diff mode, fix problems of patch 7.2.356

Bram Moolenaar

Lech Lorens wrote:

> The attached patch fixes the problems with patch 7.2.356 (by actually
> reverting the patch) which caused the folds to be closed in too many
> situations.
> Changes:
> - in case of 'foldmethod' change the folds are closed only if 'fdm' is
>   changed to 'diff',
> - folds are closed when one of the following commands is used:
>   :diffsplit, :diffthis, :diffpatch.
>
> To decrease the likelihood of undesired side effects the code handling
> the normal zM command has been reused.
>
> My apologies for the problems introduced by 7.2.356.

I think some of this doesn't need to be reverted.  E.g.:

>      fold_T *fp;
>  
>      /* Mark all folds from top to bot as maybe-small. */
> -    (void)foldFind(&curwin->w_folds, top, &fp);
> +    (void)foldFind(&curwin->w_folds, curwin->w_cursor.lnum, &fp);
>      while (fp < (fold_T *)curwin->w_folds.ga_data + curwin->w_folds.ga_len
>      && fp->fd_top < bot)
>      {

I think "top" is the right value.  Didn't run some tests with/without
this change though.

--
Place mark here ->[ ]<- if you want a dirty monitor.

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: [patch] Close folds when entering diff mode, fix problems of patch 7.2.356

Lech Lorens
On 19-02-2010 Bram Moolenaar <[hidden email]> wrote:

>
> Lech Lorens wrote:
>
> > The attached patch fixes the problems with patch 7.2.356 (by actually
> > reverting the patch) which caused the folds to be closed in too many
> > situations.
>
> I think some of this doesn't need to be reverted.  E.g.:
>
> >      fold_T *fp;
> >  
> >      /* Mark all folds from top to bot as maybe-small. */
> > -    (void)foldFind(&curwin->w_folds, top, &fp);
> > +    (void)foldFind(&curwin->w_folds, curwin->w_cursor.lnum, &fp);
> >      while (fp < (fold_T *)curwin->w_folds.ga_data + curwin->w_folds.ga_len
> >      && fp->fd_top < bot)
> >      {
>
> I think "top" is the right value.  Didn't run some tests with/without
> this change though.
OK.

I updated test45.in and test45.ok so that they discover the problem with
syntax-based folds getting closed when ^L is hit. The updated test 45
- succeeds for Vim 7.2.355,
- fails for 7.2.356 and any more recent Vim version,
- succeeds again if the patch from my last email is applied.

--
Cheers,
Lech

--
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php

close-diff-folds-test.patch (697 bytes) Download Attachment