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/testdir/test_fold.vim | |
| 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/testdir/test_fold.vim')
| -rw-r--r-- | src/nvim/testdir/test_fold.vim | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_fold.vim b/src/nvim/testdir/test_fold.vim index b1d91fd879..da3e0ffc99 100644 --- a/src/nvim/testdir/test_fold.vim +++ b/src/nvim/testdir/test_fold.vim @@ -921,4 +921,33 @@ func Test_fold_split() bw! endfunc +" Make sure that when you delete 1 line of a fold whose length is 2 lines, the +" fold can't be closed since its length (1) is now less than foldminlines. +func Test_indent_one_line_fold_close() + let lines =<< trim END + line 1 + line 2 + line 3 + END + + new + setlocal sw=2 foldmethod=indent + call setline(1, lines) + " open all folds, delete line, then close all folds + normal zR + 3delete + normal zM + call assert_equal(-1, foldclosed(2)) " the fold should not be closed + + " Now do the same, but delete line 2 this time; this covers different code. + " (Combining this code with the above code doesn't expose both bugs.) + 1,$delete + call setline(1, lines) + normal zR + 2delete + normal zM + call assert_equal(-1, foldclosed(2)) + bw! +endfunc + " vim: shiftwidth=2 sts=2 expandtab |