diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-02-28 21:53:56 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-02-28 21:53:56 +0100 |
commit | 1159b168dd94c1a25b4284c6544de385855df6f6 (patch) | |
tree | 6f8f4e0dc5bea4c28f3f03298f05412221874719 /src/testdir/test_fold.vim | |
parent | b113c3a618113122e62697dd73427261f8c51b2c (diff) | |
download | vim-1159b168dd94c1a25b4284c6544de385855df6f6.zip |
patch 8.0.0388: filtering lines changes folds
Problem: filtering lines through "cat", without changing the line count,
changes manual folds.
Solution: Change how marks and folds are adjusted. (Matthew Malcomson, from
neovim #6194.
Diffstat (limited to 'src/testdir/test_fold.vim')
-rw-r--r-- | src/testdir/test_fold.vim | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/src/testdir/test_fold.vim b/src/testdir/test_fold.vim index 2ac000450..1f835b876 100644 --- a/src/testdir/test_fold.vim +++ b/src/testdir/test_fold.vim @@ -1,6 +1,6 @@ " Test for folding -function! Test_address_fold() +func! Test_address_fold() new call setline(1, ['int FuncName() {/*{{{*/', 1, 2, 3, 4, 5, '}/*}}}*/', \ 'after fold 1', 'after fold 2', 'after fold 3']) @@ -62,9 +62,9 @@ function! Test_address_fold() call assert_equal(['4', '5', '}/*}}}*/'], getreg(0,1,1)) quit! -endfunction +endfunc -function! Test_indent_fold() +func! Test_indent_fold() new call setline(1, ['', 'a', ' b', ' c']) setl fen fdm=indent @@ -72,9 +72,9 @@ function! Test_indent_fold() norm! >> let a=map(range(1,4), 'foldclosed(v:val)') call assert_equal([-1,-1,-1,-1], a) -endfu +endfunc -function! Test_indent_fold() +func! Test_indent_fold() new call setline(1, ['', 'a', ' b', ' c']) setl fen fdm=indent @@ -83,9 +83,9 @@ function! Test_indent_fold() let a=map(range(1,4), 'foldclosed(v:val)') call assert_equal([-1,-1,-1,-1], a) bw! -endfu +endfunc -function! Test_indent_fold2() +func! Test_indent_fold2() new call setline(1, ['', '{{{', '}}}', '{{{', '}}}']) setl fen fdm=marker @@ -94,4 +94,21 @@ function! Test_indent_fold2() let a=map(range(1,5), 'foldclosed(v:val)') call assert_equal([-1,-1,-1,4,4], a) bw! -endfu +endfunc + +func Test_manual_fold_with_filter() + if !executable('cat') + return + endif + new + call setline(1, range(1, 20)) + 4,$fold + %foldopen + 10,$fold + %foldopen + " This filter command should not have an effect + 1,8! cat + call feedkeys('5ggzdzMGdd', 'xt') + call assert_equal(['1', '2', '3', '4', '5', '6', '7', '8', '9'], getline(1, '$')) + bwipe! +endfunc |