diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-01-04 05:36:38 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-04 05:36:38 +0800 |
commit | 12cdee72452b3013a2d01ef50cf980e1fa740242 (patch) | |
tree | 8d7eff2d12658c9dab46845f9e788ce91a002a5f /src | |
parent | 3734519e3b4ba1bf19ca772104170b0ef776be46 (diff) | |
download | rneovim-12cdee72452b3013a2d01ef50cf980e1fa740242.tar.gz rneovim-12cdee72452b3013a2d01ef50cf980e1fa740242.tar.bz2 rneovim-12cdee72452b3013a2d01ef50cf980e1fa740242.zip |
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
https://github.com/vim/vim/commit/0689b870595c687a23e102913ce5037f65d03748
Co-authored-by: Shota Nozaki <emonkak@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/fold.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/nvim/fold.c b/src/nvim/fold.c index 863c61d958..6cbf94dced 100644 --- a/src/nvim/fold.c +++ b/src/nvim/fold.c @@ -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; |