summaryrefslogtreecommitdiff
path: root/src/fold.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-02-28 21:53:56 +0100
committerBram Moolenaar <Bram@vim.org>2017-02-28 21:53:56 +0100
commit1159b168dd94c1a25b4284c6544de385855df6f6 (patch)
tree6f8f4e0dc5bea4c28f3f03298f05412221874719 /src/fold.c
parentb113c3a618113122e62697dd73427261f8c51b2c (diff)
downloadvim-git-1159b168dd94c1a25b4284c6544de385855df6f6.tar.gz
patch 8.0.0388: filtering lines changes foldsv8.0.0388
Problem: filtering lines through "cat", without changing the line count, changes manual folds. Solution: Change how marks and folds are adjusted. (Matthew Malcomson, from neovim #6194.
Diffstat (limited to 'src/fold.c')
-rw-r--r--src/fold.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/fold.c b/src/fold.c
index d3635a6d7..cba137515 100644
--- a/src/fold.c
+++ b/src/fold.c
@@ -1576,16 +1576,23 @@ foldMarkAdjustRecurse(
{
/* 5. fold is below line1 and contains line2; need to
* correct nested folds too */
- foldMarkAdjustRecurse(&fp->fd_nested, line1 - fp->fd_top,
- line2 - fp->fd_top, amount,
- amount_after + (fp->fd_top - top));
if (amount == MAXLNUM)
{
+ foldMarkAdjustRecurse(&fp->fd_nested,
+ line1 - fp->fd_top,
+ line2 - fp->fd_top,
+ amount,
+ amount_after + (fp->fd_top - top));
fp->fd_len -= line2 - fp->fd_top + 1;
fp->fd_top = line1;
}
else
{
+ foldMarkAdjustRecurse(&fp->fd_nested,
+ line1 - fp->fd_top,
+ line2 - fp->fd_top,
+ amount,
+ amount_after - amount);
fp->fd_len += amount_after - amount;
fp->fd_top += amount;
}