mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
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.
This commit is contained in:
13
src/fold.c
13
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user