Karsten Hopp 68f85c
To: vim_dev@googlegroups.com
Karsten Hopp 68f85c
Subject: Patch 7.4.700
Karsten Hopp 68f85c
Fcc: outbox
Karsten Hopp 68f85c
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 68f85c
Mime-Version: 1.0
Karsten Hopp 68f85c
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 68f85c
Content-Transfer-Encoding: 8bit
Karsten Hopp 68f85c
------------
Karsten Hopp 68f85c
Karsten Hopp 68f85c
Patch 7.4.700
Karsten Hopp 68f85c
Problem:    Fold can't be opened after ":move". (Ein Brown)
Karsten Hopp 68f85c
Solution:   Delete the folding information and update it afterwards.
Karsten Hopp 68f85c
            (Christian Brabandt)
Karsten Hopp 68f85c
Files:      src/ex_cmds.c, src/fold.c, src/testdir/test45.in,
Karsten Hopp 68f85c
            src/testdir/test45.ok
Karsten Hopp 68f85c
Karsten Hopp 68f85c
Karsten Hopp 68f85c
*** ../vim-7.4.699/src/ex_cmds.c	2015-03-31 13:33:00.793524956 +0200
Karsten Hopp 68f85c
--- src/ex_cmds.c	2015-04-15 12:35:27.510465352 +0200
Karsten Hopp 68f85c
***************
Karsten Hopp 68f85c
*** 741,746 ****
Karsten Hopp 68f85c
--- 741,756 ----
Karsten Hopp 68f85c
      linenr_T	extra;	    /* Num lines added before line1 */
Karsten Hopp 68f85c
      linenr_T	num_lines;  /* Num lines moved */
Karsten Hopp 68f85c
      linenr_T	last_line;  /* Last line in file after adding new text */
Karsten Hopp 68f85c
+ #ifdef FEAT_FOLDING
Karsten Hopp 68f85c
+     int		isFolded;
Karsten Hopp 68f85c
+ 
Karsten Hopp 68f85c
+     /* Moving lines seems to corrupt the folds, delete folding info now
Karsten Hopp 68f85c
+      * and recreate it when finished.  Don't do this for manual folding, it
Karsten Hopp 68f85c
+      * would delete all folds. */
Karsten Hopp 68f85c
+     isFolded = hasAnyFolding(curwin) && !foldmethodIsManual(curwin);
Karsten Hopp 68f85c
+     if (isFolded)
Karsten Hopp 68f85c
+ 	deleteFoldRecurse(&curwin->w_folds);
Karsten Hopp 68f85c
+ #endif
Karsten Hopp 68f85c
  
Karsten Hopp 68f85c
      if (dest >= line1 && dest < line2)
Karsten Hopp 68f85c
      {
Karsten Hopp 68f85c
***************
Karsten Hopp 68f85c
*** 839,844 ****
Karsten Hopp 68f85c
--- 849,860 ----
Karsten Hopp 68f85c
      else
Karsten Hopp 68f85c
  	changed_lines(dest + 1, 0, line1 + num_lines, 0L);
Karsten Hopp 68f85c
  
Karsten Hopp 68f85c
+ #ifdef FEAT_FOLDING
Karsten Hopp 68f85c
+ 	/* recreate folds */
Karsten Hopp 68f85c
+ 	if (isFolded)
Karsten Hopp 68f85c
+ 	    foldUpdateAll(curwin);
Karsten Hopp 68f85c
+ #endif
Karsten Hopp 68f85c
+ 
Karsten Hopp 68f85c
      return OK;
Karsten Hopp 68f85c
  }
Karsten Hopp 68f85c
  
Karsten Hopp 68f85c
*** ../vim-7.4.699/src/fold.c	2015-04-13 20:52:31.744841858 +0200
Karsten Hopp 68f85c
--- src/fold.c	2015-04-15 12:32:53.216048664 +0200
Karsten Hopp 68f85c
***************
Karsten Hopp 68f85c
*** 847,854 ****
Karsten Hopp 68f85c
      fold_T	*fp;
Karsten Hopp 68f85c
  
Karsten Hopp 68f85c
      /* Mark all folds from top to bot as maybe-small. */
Karsten Hopp 68f85c
!     (void)foldFind(&curwin->w_folds, top, &fp);
Karsten Hopp 68f85c
!     while (fp < (fold_T *)curwin->w_folds.ga_data + curwin->w_folds.ga_len
Karsten Hopp 68f85c
  	    && fp->fd_top < bot)
Karsten Hopp 68f85c
      {
Karsten Hopp 68f85c
  	fp->fd_small = MAYBE;
Karsten Hopp 68f85c
--- 847,854 ----
Karsten Hopp 68f85c
      fold_T	*fp;
Karsten Hopp 68f85c
  
Karsten Hopp 68f85c
      /* Mark all folds from top to bot as maybe-small. */
Karsten Hopp 68f85c
!     (void)foldFind(&wp->w_folds, top, &fp);
Karsten Hopp 68f85c
!     while (fp < (fold_T *)wp->w_folds.ga_data + wp->w_folds.ga_len
Karsten Hopp 68f85c
  	    && fp->fd_top < bot)
Karsten Hopp 68f85c
      {
Karsten Hopp 68f85c
  	fp->fd_small = MAYBE;
Karsten Hopp 68f85c
*** ../vim-7.4.699/src/testdir/test45.in	2010-05-15 13:04:10.000000000 +0200
Karsten Hopp 68f85c
--- src/testdir/test45.in	2015-04-15 12:31:42.396804175 +0200
Karsten Hopp 68f85c
***************
Karsten Hopp 68f85c
*** 63,68 ****
Karsten Hopp 68f85c
--- 63,78 ----
Karsten Hopp 68f85c
  :call append("$", foldlevel("."))
Karsten Hopp 68f85c
  :/^last/+1,$w! test.out
Karsten Hopp 68f85c
  :delfun Flvl
Karsten Hopp 68f85c
+ :new
Karsten Hopp 68f85c
+ iTest fdm=indent and :move bug END
Karsten Hopp 68f85c
+ line2
Karsten Hopp 68f85c
+ 	Test fdm=indent START
Karsten Hopp 68f85c
+ 	line3
Karsten Hopp 68f85c
+ 	line4?
Karsten Hopp 68f85c
+ :set fdm=indent
Karsten Hopp 68f85c
+ :1m1
Karsten Hopp 68f85c
+ 2jzc:m0
Karsten Hopp 68f85c
+ :%w >> test.out
Karsten Hopp 68f85c
  :qa!
Karsten Hopp 68f85c
  ENDTEST
Karsten Hopp 68f85c
  
Karsten Hopp 68f85c
*** ../vim-7.4.699/src/testdir/test45.ok	2010-05-15 13:04:10.000000000 +0200
Karsten Hopp 68f85c
--- src/testdir/test45.ok	2015-04-15 12:31:42.400804132 +0200
Karsten Hopp 68f85c
***************
Karsten Hopp 68f85c
*** 16,18 ****
Karsten Hopp 68f85c
--- 16,23 ----
Karsten Hopp 68f85c
  1
Karsten Hopp 68f85c
  2
Karsten Hopp 68f85c
  0
Karsten Hopp 68f85c
+ 	Test fdm=indent START
Karsten Hopp 68f85c
+ 	line3
Karsten Hopp 68f85c
+ 	line4
Karsten Hopp 68f85c
+ Test fdm=indent and :move bug END
Karsten Hopp 68f85c
+ line2
Karsten Hopp 68f85c
*** ../vim-7.4.699/src/version.c	2015-04-13 20:52:31.744841858 +0200
Karsten Hopp 68f85c
--- src/version.c	2015-04-15 12:43:01.329818386 +0200
Karsten Hopp 68f85c
***************
Karsten Hopp 68f85c
*** 743,744 ****
Karsten Hopp 68f85c
--- 743,746 ----
Karsten Hopp 68f85c
  {   /* Add new patch number below this line */
Karsten Hopp 68f85c
+ /**/
Karsten Hopp 68f85c
+     700,
Karsten Hopp 68f85c
  /**/
Karsten Hopp 68f85c
Karsten Hopp 68f85c
-- 
Karsten Hopp 68f85c
Computers make very fast, very accurate, mistakes.
Karsten Hopp 68f85c
Karsten Hopp 68f85c
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 68f85c
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 68f85c
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 68f85c
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///