mirror of
https://github.com/vim/vim.git
synced 2025-09-04 21:33:48 -04:00
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)
This commit is contained in:
parent
05b20fb14e
commit
d5f6933d5c
@ -741,6 +741,16 @@ do_move(line1, line2, dest)
|
|||||||
linenr_T extra; /* Num lines added before line1 */
|
linenr_T extra; /* Num lines added before line1 */
|
||||||
linenr_T num_lines; /* Num lines moved */
|
linenr_T num_lines; /* Num lines moved */
|
||||||
linenr_T last_line; /* Last line in file after adding new text */
|
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)
|
if (dest >= line1 && dest < line2)
|
||||||
{
|
{
|
||||||
@ -839,6 +849,12 @@ do_move(line1, line2, dest)
|
|||||||
else
|
else
|
||||||
changed_lines(dest + 1, 0, line1 + num_lines, 0L);
|
changed_lines(dest + 1, 0, line1 + num_lines, 0L);
|
||||||
|
|
||||||
|
#ifdef FEAT_FOLDING
|
||||||
|
/* recreate folds */
|
||||||
|
if (isFolded)
|
||||||
|
foldUpdateAll(curwin);
|
||||||
|
#endif
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -847,8 +847,8 @@ foldUpdate(wp, top, bot)
|
|||||||
fold_T *fp;
|
fold_T *fp;
|
||||||
|
|
||||||
/* Mark all folds from top to bot as maybe-small. */
|
/* Mark all folds from top to bot as maybe-small. */
|
||||||
(void)foldFind(&curwin->w_folds, top, &fp);
|
(void)foldFind(&wp->w_folds, top, &fp);
|
||||||
while (fp < (fold_T *)curwin->w_folds.ga_data + curwin->w_folds.ga_len
|
while (fp < (fold_T *)wp->w_folds.ga_data + wp->w_folds.ga_len
|
||||||
&& fp->fd_top < bot)
|
&& fp->fd_top < bot)
|
||||||
{
|
{
|
||||||
fp->fd_small = MAYBE;
|
fp->fd_small = MAYBE;
|
||||||
|
@ -63,6 +63,16 @@ endfun
|
|||||||
:call append("$", foldlevel("."))
|
:call append("$", foldlevel("."))
|
||||||
:/^last/+1,$w! test.out
|
:/^last/+1,$w! test.out
|
||||||
:delfun Flvl
|
: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!
|
:qa!
|
||||||
ENDTEST
|
ENDTEST
|
||||||
|
|
||||||
|
@ -16,3 +16,8 @@ expr 2
|
|||||||
1
|
1
|
||||||
2
|
2
|
||||||
0
|
0
|
||||||
|
Test fdm=indent START
|
||||||
|
line3
|
||||||
|
line4
|
||||||
|
Test fdm=indent and :move bug END
|
||||||
|
line2
|
||||||
|
@ -741,6 +741,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
700,
|
||||||
/**/
|
/**/
|
||||||
699,
|
699,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user