diff options
author | Brandon Simmons <simmsbra@gmail.com> | 2022-05-20 18:25:21 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-05-20 18:25:21 +0100 |
commit | 3fcccf94e8bc142d2c79c3b62087145896df6b36 (patch) | |
tree | 166b3c7d3b4be078dab7f7b843de6187c6cfb625 /src/fold.c | |
parent | 8a83ffdc43a4fc904f686864a24a5b0f240df593 (diff) |
patch 8.2.4987: after deletion a small fold may be closablev8.2.4987
Problem: After deletion a small fold may be closable.
Solution: Check for a reverse range. (Brandon Simmons, closes #10457)
Diffstat (limited to 'src/fold.c')
-rw-r--r-- | src/fold.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/fold.c b/src/fold.c index 7c51557073..26a4a98a76 100644 --- a/src/fold.c +++ b/src/fold.c @@ -829,10 +829,18 @@ foldUpdate(win_T *wp, linenr_T top, linenr_T bot) if (wp->w_folds.ga_len > 0) { - // Mark all folds from top to bot as maybe-small. - (void)foldFind(&wp->w_folds, top, &fp); + linenr_T maybe_small_start = top; + linenr_T maybe_small_end = bot; + + // Mark all folds from top to bot (or bot to top) as maybe-small. + if (top > bot) + { + maybe_small_start = bot; + maybe_small_end = top; + } + (void)foldFind(&wp->w_folds, maybe_small_start, &fp); while (fp < (fold_T *)wp->w_folds.ga_data + wp->w_folds.ga_len - && fp->fd_top < bot) + && fp->fd_top <= maybe_small_end) { fp->fd_small = MAYBE; ++fp; @@ -2165,7 +2173,7 @@ foldUpdateIEMS(win_T *wp, linenr_T top, linenr_T bot) bot = wp->w_buffer->b_ml.ml_line_count; wp->w_foldinvalid = FALSE; - // Mark all folds a maybe-small. + // Mark all folds as maybe-small. setSmallMaybe(&wp->w_folds); } |