Mercurial > vim
diff src/fold.c @ 10998:2645a98217fa v8.0.0388
patch 8.0.0388: filtering lines changes folds
commit https://github.com/vim/vim/commit/1159b168dd94c1a25b4284c6544de385855df6f6
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Feb 28 21:53:56 2017 +0100
patch 8.0.0388: filtering lines changes folds
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.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 28 Feb 2017 22:00:05 +0100 |
parents | 4aead6a9b7a9 |
children | c8b49300c6b7 |
line wrap: on
line diff
--- 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; }