mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 14:38:32 +00:00
vim-patch:9.1.0002: a closing fold expr, may start a new fold (#26876)
Problem: a closing fold expression may unexpectedly start a new fold
when it should end a fold
(reported by Shota Nozaki)
Solution: if a fold hasn't started yet, do not immediately
start a new fold with level 1
(Shota Nozaki)
fixes: vim/vim#12768
closes: vim/vim#13748
0689b87059
Co-authored-by: Shota Nozaki <emonkak@gmail.com>
This commit is contained in:
@@ -2980,7 +2980,9 @@ static void foldlevelExpr(fline_T *flp)
|
||||
|
||||
// "<1", "<2", .. : end a fold with a certain level
|
||||
case '<':
|
||||
flp->lvl_next = n - 1;
|
||||
// To prevent an unexpected start of a new fold, the next
|
||||
// level must not exceed the level of the current fold.
|
||||
flp->lvl_next = MIN(flp->lvl, n - 1);
|
||||
flp->end = n;
|
||||
break;
|
||||
|
||||
|
Reference in New Issue
Block a user