Karsten Hopp 7dd25a
To: vim-dev@vim.org
Karsten Hopp 7dd25a
Subject: Patch 7.2.370
Karsten Hopp 7dd25a
Fcc: outbox
Karsten Hopp 7dd25a
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 7dd25a
Mime-Version: 1.0
Karsten Hopp 7dd25a
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 7dd25a
Content-Transfer-Encoding: 8bit
Karsten Hopp 7dd25a
------------
Karsten Hopp 7dd25a
Karsten Hopp 7dd25a
Patch 7.2.370 (after 7.2.356)
Karsten Hopp 7dd25a
Problem:    A redraw may cause folds to be closed.
Karsten Hopp 7dd25a
Solution:   Revert part of the previous patch.  Add a test. (Lech Lorens)
Karsten Hopp 7dd25a
Files:	    src/diff.c, src/fold.c, src/option.c, src/testdir/test45.in,
Karsten Hopp 7dd25a
	    src/testdir/test45.ok
Karsten Hopp 7dd25a
Karsten Hopp 7dd25a
Karsten Hopp 7dd25a
*** ../vim-7.2.369/src/diff.c	2009-07-22 16:22:33.000000000 +0200
Karsten Hopp 7dd25a
--- src/diff.c	2010-02-24 14:31:12.000000000 +0100
Karsten Hopp 7dd25a
***************
Karsten Hopp 7dd25a
*** 1117,1142 ****
Karsten Hopp 7dd25a
      win_T	*wp;
Karsten Hopp 7dd25a
      int		addbuf;		/* Add buffer to diff. */
Karsten Hopp 7dd25a
  {
Karsten Hopp 7dd25a
      wp->w_p_diff = TRUE;
Karsten Hopp 7dd25a
      wp->w_p_scb = TRUE;
Karsten Hopp 7dd25a
      wp->w_p_wrap = FALSE;
Karsten Hopp 7dd25a
  # ifdef FEAT_FOLDING
Karsten Hopp 7dd25a
!     {
Karsten Hopp 7dd25a
! 	win_T	    *old_curwin = curwin;
Karsten Hopp 7dd25a
! 
Karsten Hopp 7dd25a
! 	curwin = wp;
Karsten Hopp 7dd25a
! 	curbuf = curwin->w_buffer;
Karsten Hopp 7dd25a
! 	set_string_option_direct((char_u *)"fdm", -1, (char_u *)"diff",
Karsten Hopp 7dd25a
  						       OPT_LOCAL|OPT_FREE, 0);
Karsten Hopp 7dd25a
! 	curwin = old_curwin;
Karsten Hopp 7dd25a
! 	curbuf = curwin->w_buffer;
Karsten Hopp 7dd25a
! 	wp->w_p_fdc = diff_foldcolumn;
Karsten Hopp 7dd25a
! 	wp->w_p_fen = TRUE;
Karsten Hopp 7dd25a
! 	wp->w_p_fdl = 0;
Karsten Hopp 7dd25a
! 	foldUpdateAll(wp);
Karsten Hopp 7dd25a
! 	/* make sure topline is not halfway a fold */
Karsten Hopp 7dd25a
! 	changed_window_setting_win(wp);
Karsten Hopp 7dd25a
!     }
Karsten Hopp 7dd25a
  # endif
Karsten Hopp 7dd25a
  #ifdef FEAT_SCROLLBIND
Karsten Hopp 7dd25a
      if (vim_strchr(p_sbo, 'h') == NULL)
Karsten Hopp 7dd25a
--- 1117,1147 ----
Karsten Hopp 7dd25a
      win_T	*wp;
Karsten Hopp 7dd25a
      int		addbuf;		/* Add buffer to diff. */
Karsten Hopp 7dd25a
  {
Karsten Hopp 7dd25a
+ # ifdef FEAT_FOLDING
Karsten Hopp 7dd25a
+     win_T *old_curwin = curwin;
Karsten Hopp 7dd25a
+ 
Karsten Hopp 7dd25a
+     /* close the manually opened folds */
Karsten Hopp 7dd25a
+     curwin = wp;
Karsten Hopp 7dd25a
+     newFoldLevel();
Karsten Hopp 7dd25a
+     curwin = old_curwin;
Karsten Hopp 7dd25a
+ # endif
Karsten Hopp 7dd25a
+ 
Karsten Hopp 7dd25a
      wp->w_p_diff = TRUE;
Karsten Hopp 7dd25a
      wp->w_p_scb = TRUE;
Karsten Hopp 7dd25a
      wp->w_p_wrap = FALSE;
Karsten Hopp 7dd25a
  # ifdef FEAT_FOLDING
Karsten Hopp 7dd25a
!     curwin = wp;
Karsten Hopp 7dd25a
!     curbuf = curwin->w_buffer;
Karsten Hopp 7dd25a
!     set_string_option_direct((char_u *)"fdm", -1, (char_u *)"diff",
Karsten Hopp 7dd25a
  						       OPT_LOCAL|OPT_FREE, 0);
Karsten Hopp 7dd25a
!     curwin = old_curwin;
Karsten Hopp 7dd25a
!     curbuf = curwin->w_buffer;
Karsten Hopp 7dd25a
!     wp->w_p_fdc = diff_foldcolumn;
Karsten Hopp 7dd25a
!     wp->w_p_fen = TRUE;
Karsten Hopp 7dd25a
!     wp->w_p_fdl = 0;
Karsten Hopp 7dd25a
!     foldUpdateAll(wp);
Karsten Hopp 7dd25a
!     /* make sure topline is not halfway a fold */
Karsten Hopp 7dd25a
!     changed_window_setting_win(wp);
Karsten Hopp 7dd25a
  # endif
Karsten Hopp 7dd25a
  #ifdef FEAT_SCROLLBIND
Karsten Hopp 7dd25a
      if (vim_strchr(p_sbo, 'h') == NULL)
Karsten Hopp 7dd25a
*** ../vim-7.2.369/src/fold.c	2010-02-03 18:14:41.000000000 +0100
Karsten Hopp 7dd25a
--- src/fold.c	2010-02-24 13:09:04.000000000 +0100
Karsten Hopp 7dd25a
***************
Karsten Hopp 7dd25a
*** 854,865 ****
Karsten Hopp 7dd25a
  	    && fp->fd_top < bot)
Karsten Hopp 7dd25a
      {
Karsten Hopp 7dd25a
  	fp->fd_small = MAYBE;
Karsten Hopp 7dd25a
- 
Karsten Hopp 7dd25a
- 	/* Not sure if this is the right place to reset fd_flags (suggested by
Karsten Hopp 7dd25a
- 	 * Lech Lorens). */
Karsten Hopp 7dd25a
-         if (wp->w_foldinvalid)
Karsten Hopp 7dd25a
-             fp->fd_flags = FD_LEVEL;
Karsten Hopp 7dd25a
- 
Karsten Hopp 7dd25a
  	++fp;
Karsten Hopp 7dd25a
      }
Karsten Hopp 7dd25a
  
Karsten Hopp 7dd25a
--- 854,859 ----
Karsten Hopp 7dd25a
*** ../vim-7.2.369/src/option.c	2010-02-11 17:02:04.000000000 +0100
Karsten Hopp 7dd25a
--- src/option.c	2010-02-24 13:09:44.000000000 +0100
Karsten Hopp 7dd25a
***************
Karsten Hopp 7dd25a
*** 6586,6592 ****
Karsten Hopp 7dd25a
--- 6586,6596 ----
Karsten Hopp 7dd25a
  		|| *curwin->w_p_fdm == NUL)
Karsten Hopp 7dd25a
  	    errmsg = e_invarg;
Karsten Hopp 7dd25a
  	else
Karsten Hopp 7dd25a
+ 	{
Karsten Hopp 7dd25a
  	    foldUpdateAll(curwin);
Karsten Hopp 7dd25a
+ 	    if (foldmethodIsDiff(curwin))
Karsten Hopp 7dd25a
+ 		newFoldLevel();
Karsten Hopp 7dd25a
+ 	}
Karsten Hopp 7dd25a
      }
Karsten Hopp 7dd25a
  # ifdef FEAT_EVAL
Karsten Hopp 7dd25a
      /* 'foldexpr' */
Karsten Hopp 7dd25a
*** ../vim-7.2.369/src/testdir/test45.in	2009-11-03 14:46:35.000000000 +0100
Karsten Hopp 7dd25a
--- src/testdir/test45.in	2010-02-24 13:02:39.000000000 +0100
Karsten Hopp 7dd25a
***************
Karsten Hopp 7dd25a
*** 36,41 ****
Karsten Hopp 7dd25a
--- 36,43 ----
Karsten Hopp 7dd25a
  k:call append("$", getline("."))
Karsten Hopp 7dd25a
  jAcommentstart  ?Acommentend?:set fdl=1
Karsten Hopp 7dd25a
  3j:call append("$", getline("."))
Karsten Hopp 7dd25a
+ :set fdl=0
Karsten Hopp 7dd25a
+ zO?j:call append("$", getline("."))
Karsten Hopp 7dd25a
  :" test expression folding
Karsten Hopp 7dd25a
  :fun Flvl()
Karsten Hopp 7dd25a
    let l = getline(v:lnum)
Karsten Hopp 7dd25a
*** ../vim-7.2.369/src/testdir/test45.ok	2009-11-03 14:46:35.000000000 +0100
Karsten Hopp 7dd25a
--- src/testdir/test45.ok	2010-02-24 12:58:55.000000000 +0100
Karsten Hopp 7dd25a
***************
Karsten Hopp 7dd25a
*** 11,16 ****
Karsten Hopp 7dd25a
--- 11,17 ----
Karsten Hopp 7dd25a
  folding 9 ii
Karsten Hopp 7dd25a
      3 cc
Karsten Hopp 7dd25a
  7 gg
Karsten Hopp 7dd25a
+ 8 hh
Karsten Hopp 7dd25a
  expr 2
Karsten Hopp 7dd25a
  1
Karsten Hopp 7dd25a
  2
Karsten Hopp 7dd25a
*** ../vim-7.2.369/src/version.c	2010-02-24 13:59:09.000000000 +0100
Karsten Hopp 7dd25a
--- src/version.c	2010-02-24 14:28:20.000000000 +0100
Karsten Hopp 7dd25a
***************
Karsten Hopp 7dd25a
*** 683,684 ****
Karsten Hopp 7dd25a
--- 683,686 ----
Karsten Hopp 7dd25a
  {   /* Add new patch number below this line */
Karsten Hopp 7dd25a
+ /**/
Karsten Hopp 7dd25a
+     370,
Karsten Hopp 7dd25a
  /**/
Karsten Hopp 7dd25a
Karsten Hopp 7dd25a
-- 
Karsten Hopp 7dd25a
MAN:    Fetchez la vache!
Karsten Hopp 7dd25a
GUARD:  Quoi?
Karsten Hopp 7dd25a
MAN:    Fetchez la vache!
Karsten Hopp 7dd25a
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
Karsten Hopp 7dd25a
Karsten Hopp 7dd25a
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 7dd25a
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 7dd25a
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 7dd25a
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///