0
0
mirror of https://github.com/vim/vim.git synced 2025-09-28 04:24:06 -04:00

patch 8.0.0457: using :move messes up manual folds

Problem:    Using :move messes up manual folds.
Solution:   Split adjusting marks and folds.  Add foldMoveRange(). (neovim
            patch #6221)
This commit is contained in:
Bram Moolenaar
2017-03-14 21:53:58 +01:00
parent 84be8b6660
commit 88d298aed8
7 changed files with 355 additions and 10 deletions

View File

@@ -37,6 +37,8 @@ static void cleanup_jumplist(void);
#ifdef FEAT_VIMINFO
static void write_one_filemark(FILE *fp, xfmark_T *fm, int c1, int c2);
#endif
static void mark_adjust_internal(linenr_T line1, linenr_T line2, long amount,
long amount_after, int adjust_folds);
/*
* Set named mark "c" at current cursor position.
@@ -1028,6 +1030,27 @@ mark_adjust(
linenr_T line2,
long amount,
long amount_after)
{
mark_adjust_internal(line1, line2, amount, amount_after, TRUE);
}
void
mark_adjust_nofold(
linenr_T line1,
linenr_T line2,
long amount,
long amount_after)
{
mark_adjust_internal(line1, line2, amount, amount_after, FALSE);
}
static void
mark_adjust_internal(
linenr_T line1,
linenr_T line2,
long amount,
long amount_after,
int adjust_folds UNUSED)
{
int i;
int fnum = curbuf->b_fnum;
@@ -1174,7 +1197,8 @@ mark_adjust(
#ifdef FEAT_FOLDING
/* adjust folds */
foldMarkAdjust(win, line1, line2, amount, amount_after);
if (adjust_folds)
foldMarkAdjust(win, line1, line2, amount, amount_after);
#endif
}
}