Mercurial > vim
diff src/testdir/test_fold.vim @ 31053:39f96b1e7b8d v9.0.0861
patch 9.0.0861: solution for "!!sort" in closed fold is not optimal
Commit: https://github.com/vim/vim/commit/9954dc39ea090cee6bf41c888c41e60d9f52c3b8
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Nov 11 22:58:36 2022 +0000
patch 9.0.0861: solution for "!!sort" in closed fold is not optimal
Problem: Solution for "!!sort" in closed fold is not optimal.
Solution: Use a different range instead of the subtle difference in handling
a range with an offset. (issue #11487)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 12 Nov 2022 00:00:04 +0100 |
parents | ac1f548223a5 |
children | 6d42026ad002 |
line wrap: on
line diff
--- a/src/testdir/test_fold.vim +++ b/src/testdir/test_fold.vim @@ -72,6 +72,54 @@ func Test_address_fold() quit! endfunc +func Test_address_offsets() + " check the help for :range-closed-fold + enew + call setline(1, [ + \ '1 one', + \ '2 two', + \ '3 three', + \ '4 four FOLDED', + \ '5 five FOLDED', + \ '6 six', + \ '7 seven', + \ '8 eight', + \]) + set foldmethod=manual + normal 4Gvjzf + 3,4+2yank + call assert_equal([ + \ '3 three', + \ '4 four FOLDED', + \ '5 five FOLDED', + \ '6 six', + \ '7 seven', + \ ], getreg(0,1,1)) + + enew! + call setline(1, [ + \ '1 one', + \ '2 two', + \ '3 three FOLDED', + \ '4 four FOLDED', + \ '5 five FOLDED', + \ '6 six FOLDED', + \ '7 seven', + \ '8 eight', + \]) + normal 3Gv3jzf + 2,4-1yank + call assert_equal([ + \ '2 two', + \ '3 three FOLDED', + \ '4 four FOLDED', + \ '5 five FOLDED', + \ '6 six FOLDED', + \ ], getreg(0,1,1)) + + bwipe! +endfunc + func Test_indent_fold() new call setline(1, ['', 'a', ' b', ' c'])