Mercurial > vim
changeset 2086:c11845a465ae v7.2.370
updated for version 7.2.370
Problem: A redraw may cause folds to be closed.
Solution: Revert part of the previous patch. Add a test. (Lech Lorens)
author | Bram Moolenaar <bram@zimbu.org> |
---|---|
date | Wed, 24 Feb 2010 14:34:19 +0100 |
parents | 5a84b6388a55 |
children | 3112fcc89238 |
files | src/diff.c src/fold.c src/option.c src/testdir/test45.in src/testdir/test45.ok src/version.c |
diffstat | 6 files changed, 29 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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; }
--- a/src/option.c +++ b/src/option.c @@ -6586,7 +6586,11 @@ did_set_string_option(opt_idx, varp, new || *curwin->w_p_fdm == NUL) errmsg = e_invarg; else + { foldUpdateAll(curwin); + if (foldmethodIsDiff(curwin)) + newFoldLevel(); + } } # ifdef FEAT_EVAL /* 'foldexpr' */
--- a/src/testdir/test45.in +++ b/src/testdir/test45.in @@ -36,6 +36,8 @@ Gzk:call append("$", "folding " . getlin k:call append("$", getline(".")) jAcommentstart Acommentend:set fdl=1 3j:call append("$", getline(".")) +:set fdl=0 +zOj:call append("$", getline(".")) :" test expression folding :fun Flvl() let l = getline(v:lnum)