Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
10997:688165ef32ea | 10998:2645a98217fa |
---|---|
1574 } | 1574 } |
1575 else | 1575 else |
1576 { | 1576 { |
1577 /* 5. fold is below line1 and contains line2; need to | 1577 /* 5. fold is below line1 and contains line2; need to |
1578 * correct nested folds too */ | 1578 * correct nested folds too */ |
1579 foldMarkAdjustRecurse(&fp->fd_nested, line1 - fp->fd_top, | |
1580 line2 - fp->fd_top, amount, | |
1581 amount_after + (fp->fd_top - top)); | |
1582 if (amount == MAXLNUM) | 1579 if (amount == MAXLNUM) |
1583 { | 1580 { |
1581 foldMarkAdjustRecurse(&fp->fd_nested, | |
1582 line1 - fp->fd_top, | |
1583 line2 - fp->fd_top, | |
1584 amount, | |
1585 amount_after + (fp->fd_top - top)); | |
1584 fp->fd_len -= line2 - fp->fd_top + 1; | 1586 fp->fd_len -= line2 - fp->fd_top + 1; |
1585 fp->fd_top = line1; | 1587 fp->fd_top = line1; |
1586 } | 1588 } |
1587 else | 1589 else |
1588 { | 1590 { |
1591 foldMarkAdjustRecurse(&fp->fd_nested, | |
1592 line1 - fp->fd_top, | |
1593 line2 - fp->fd_top, | |
1594 amount, | |
1595 amount_after - amount); | |
1589 fp->fd_len += amount_after - amount; | 1596 fp->fd_len += amount_after - amount; |
1590 fp->fd_top += amount; | 1597 fp->fd_top += amount; |
1591 } | 1598 } |
1592 } | 1599 } |
1593 } | 1600 } |