summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/diff.c35
-rw-r--r--src/fold.c6
-rw-r--r--src/option.c4
-rw-r--r--src/testdir/test45.in2
-rw-r--r--src/testdir/test45.ok1
-rw-r--r--src/version.c2
6 files changed, 29 insertions, 21 deletions
diff --git a/src/diff.c b/src/diff.c
index f5ea0c69..bf625459 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -1117,26 +1117,31 @@ diff_win_options(wp, addbuf)
win_T *wp;
int addbuf; /* Add buffer to diff. */
{
+# ifdef FEAT_FOLDING
+ win_T *old_curwin = curwin;
+
+ /* close the manually opened folds */
+ curwin = wp;
+ newFoldLevel();
+ curwin = old_curwin;
+# endif
+
wp->w_p_diff = TRUE;
wp->w_p_scb = TRUE;
wp->w_p_wrap = FALSE;
# ifdef FEAT_FOLDING
- {
- win_T *old_curwin = curwin;
-
- curwin = wp;
- curbuf = curwin->w_buffer;
- set_string_option_direct((char_u *)"fdm", -1, (char_u *)"diff",
+ curwin = wp;
+ curbuf = curwin->w_buffer;
+ set_string_option_direct((char_u *)"fdm", -1, (char_u *)"diff",
OPT_LOCAL|OPT_FREE, 0);
- curwin = old_curwin;
- curbuf = curwin->w_buffer;
- wp->w_p_fdc = diff_foldcolumn;
- wp->w_p_fen = TRUE;
- wp->w_p_fdl = 0;
- foldUpdateAll(wp);
- /* make sure topline is not halfway a fold */
- changed_window_setting_win(wp);
- }
+ curwin = old_curwin;
+ curbuf = curwin->w_buffer;
+ wp->w_p_fdc = diff_foldcolumn;
+ wp->w_p_fen = TRUE;
+ wp->w_p_fdl = 0;
+ foldUpdateAll(wp);
+ /* make sure topline is not halfway a fold */
+ changed_window_setting_win(wp);
# endif
#ifdef FEAT_SCROLLBIND
if (vim_strchr(p_sbo, 'h') == NULL)
diff --git a/src/fold.c b/src/fold.c
index ff1139dc..a23a35c2 100644
--- a/src/fold.c
+++ b/src/fold.c
@@ -854,12 +854,6 @@ foldUpdate(wp, top, bot)
&& 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 99e94d5e..ba17c115 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' */
diff --git a/src/testdir/test45.in b/src/testdir/test45.in
index 1dfad545..e5af5073 100644
--- a/src/testdir/test45.in
+++ b/src/testdir/test45.in
@@ -36,6 +36,8 @@ Gzk:call append("$", "folding " . getline("."))
k:call append("$", getline("."))
jAcommentstart Acommentend:set fdl=1
3j:call append("$", getline("."))
+:set fdl=0
+zO j:call append("$", getline("."))
:" test expression folding
:fun Flvl()
let l = getline(v:lnum)
diff --git a/src/testdir/test45.ok b/src/testdir/test45.ok
index 713cf882..f04996e3 100644
--- a/src/testdir/test45.ok
+++ b/src/testdir/test45.ok
@@ -11,6 +11,7 @@ indent 2
folding 9 ii
3 cc
7 gg
+8 hh
expr 2
1
2
diff --git a/src/version.c b/src/version.c
index cbdcf2e9..212e34d7 100644
--- a/src/version.c
+++ b/src/version.c
@@ -682,6 +682,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 370,
+/**/
369,
/**/
368,