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
diff --git a/src/diff.c b/src/diff.c
index f5ea0c6..b646329 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -1117,6 +1117,12 @@ diff_win_options(wp, addbuf)
win_T *wp;
int addbuf; /* Add buffer to diff. */
{
+ win_T *curwin_saved = curwin;
+ /* close the manually opened folds */
+ curwin = wp;
+ newFoldLevel();
+ curwin = curwin_saved;
+
wp->w_p_diff = TRUE;
wp->w_p_scb = TRUE;
wp->w_p_wrap = FALSE;
diff --git a/src/fold.c b/src/fold.c
index ff1139d..405a6ef 100644
--- a/src/fold.c
+++ b/src/fold.c
@@ -849,17 +849,11 @@ foldUpdate(wp, top, bot)
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)
{
fp->fd_small = MAYBE;
-
- /* Not sure if this is the right place to reset fd_flags (suggested by
- * Lech Lorens). */
- if (wp->w_foldinvalid)
- fp->fd_flags = FD_LEVEL;
-
++fp;
}
diff --git a/src/option.c b/src/option.c
index 99e94d5..746945e 100644
--- a/src/option.c
+++ b/src/option.c
@@ -6586,7 +6586,11 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
|| *curwin->w_p_fdm == NUL)
errmsg = e_invarg;
else
+ {
foldUpdateAll(curwin);
+ if (foldmethodIsDiff(curwin))
+ newFoldLevel();
+ }
}
# ifdef FEAT_EVAL
/* 'foldexpr' */