diff options
Diffstat (limited to 'src/nvim/fold.c')
-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; |