diff options
author | Brandon Simmons <34775764+simmsbra@users.noreply.github.com> | 2022-05-21 18:27:54 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-22 07:27:54 +0800 |
commit | 0c4086faa17db46d27d4743095a8f16709bcf278 (patch) | |
tree | f4c69004e8f7dfe1858b7f895faab440961b242e /src/nvim/fold.c | |
parent | f0717ffade6a36c1e5aa85214f6667e384abc169 (diff) | |
download | rneovim-0c4086faa17db46d27d4743095a8f16709bcf278.tar.gz rneovim-0c4086faa17db46d27d4743095a8f16709bcf278.tar.bz2 rneovim-0c4086faa17db46d27d4743095a8f16709bcf278.zip |
vim-patch:8.2.4987: after deletion a small fold may be closable (#18683)
Problem: After deletion a small fold may be closable.
Solution: Check for a reverse range. (Brandon Simmons, closes vim/vim#10457)
https://github.com/vim/vim/commit/3fcccf94e8bc142d2c79c3b62087145896df6b36
Diffstat (limited to 'src/nvim/fold.c')
-rw-r--r-- | src/nvim/fold.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/nvim/fold.c b/src/nvim/fold.c index 2de1b8b0f9..8a4a3bbbc0 100644 --- a/src/nvim/fold.c +++ b/src/nvim/fold.c @@ -785,11 +785,18 @@ void 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. + 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; + } fold_T *fp; - (void)foldFind(&wp->w_folds, top, &fp); + (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 = kNone; fp++; } @@ -1929,7 +1936,7 @@ static void foldUpdateIEMS(win_T *const 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); } |