diff options
author | Brandon Simmons <simmsbra@gmail.com> | 2022-05-23 15:33:08 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-05-23 15:33:08 +0100 |
commit | e8c4a64bffbe628a46dc172d04cfc2db6e8dd8b6 (patch) | |
tree | 48926207f8f118931908d9b16ccd09168a176fc0 | |
parent | 7e667788150be617aeac42b0d668618ac33ab9da (diff) |
patch 8.2.5009: fold may not be closeable after appendingv8.2.5009
Problem: Fold may not be closeable after appending.
Solution: Set the fd_small flag to MAYBE. (Brandon Simmons, closes #10471)
-rw-r--r-- | src/fold.c | 1 | ||||
-rw-r--r-- | src/testdir/test_fold.vim | 19 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 22 insertions, 0 deletions
diff --git a/src/fold.c b/src/fold.c index 26a4a98a76..ee94a979f0 100644 --- a/src/fold.c +++ b/src/fold.c @@ -2574,6 +2574,7 @@ foldUpdateIEMSRecurse( (long)(fp->fd_top - firstlnum)); fp->fd_len += fp->fd_top - firstlnum; fp->fd_top = firstlnum; + fp->fd_small = MAYBE; fold_changed = TRUE; } else if ((flp->start != 0 && lvl == level) diff --git a/src/testdir/test_fold.vim b/src/testdir/test_fold.vim index 67a399ddd8..3bdd99fc0e 100644 --- a/src/testdir/test_fold.vim +++ b/src/testdir/test_fold.vim @@ -1528,4 +1528,23 @@ func Test_indent_one_line_fold_close() bw! endfunc +" Make sure that when appending [an indented line then a blank line] right +" before a single indented line, the resulting extended fold can be closed +func Test_indent_append_blank_small_fold_close() + new + setlocal sw=2 foldmethod=indent + " at first, the fold at the second line can't be closed since it's smaller + " than foldminlines + let lines =<< trim END + line 1 + line 4 + END + call setline(1, lines) + call append(1, [' line 2', '']) + " close all folds + normal zM + call assert_notequal(-1, foldclosed(2)) " the fold should be closed now + bw! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 36350c3b35..07f1b5d63f 100644 --- a/src/version.c +++ b/src/version.c @@ -735,6 +735,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 5009, +/**/ 5008, /**/ 5007, |