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