mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 06:28:35 +00:00
vim-patch:8.0.0388
Fix a problem when filtering manually folded lines When foldMarkAdjustRecurse() is called to adjust folds that start inside the range of lines that are being moved and end outside that range, it calculates `amount_after` for its recursive call incorrectly. The calculation assumes that folds inside the changed range are being deleted, but this is not always the case. This means nested folds that start after the changed range of lines are shifted an incorrect amount. We fix this by calculating the `amount_after` differently if the folds inside the changed range are not being deleted.
This commit is contained in:

committed by
Justin M. Keyes

parent
689e0daa95
commit
b1731fe1b5
@@ -1438,13 +1438,16 @@ static void foldMarkAdjustRecurse(garray_T *gap, linenr_T line1, linenr_T line2,
|
||||
} else {
|
||||
/* 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