Mercurial > vim
annotate src/testdir/test_fold.vim @ 23068:2f034cb0a046 v8.2.2080
patch 8.2.2080: Vim9: no proper error message for using s:var in for loop
Commit: https://github.com/vim/vim/commit/ea87069d7814497181483877651aef6d97182120
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Dec 2 14:24:30 2020 +0100
patch 8.2.2080: Vim9: no proper error message for using s:var in for loop
Problem: Vim9: no proper error message for using s:var in for loop.
Solution: Give a specific error.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 02 Dec 2020 14:30:03 +0100 |
parents | f74978697fb6 |
children | ef4f890f02f6 |
rev | line source |
---|---|
10484
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Test for folding |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
3 source check.vim |
14317
1bc96dbb5498
patch 8.1.0174: after paging up and down fold line is wrong
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
4 source view_util.vim |
14875
081f30c50300
patch 8.1.0449: when 'rnu' is set folded lines are not displayed correctly
Christian Brabandt <cb@256bit.org>
parents:
14317
diff
changeset
|
5 source screendump.vim |
14317
1bc96dbb5498
patch 8.1.0174: after paging up and down fold line is wrong
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
6 |
11392
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
7 func PrepIndent(arg) |
11140
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
8 return [a:arg] + repeat(["\t".a:arg], 5) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
9 endfu |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
10 |
11392
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
11 func Test_address_fold() |
10484
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 new |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 call setline(1, ['int FuncName() {/*{{{*/', 1, 2, 3, 4, 5, '}/*}}}*/', |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 \ 'after fold 1', 'after fold 2', 'after fold 3']) |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 setl fen fdm=marker |
11219
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
16 " The next commands should all copy the same part of the buffer, |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
17 " regardless of the addressing type, since the part to be copied |
10484
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 " is folded away |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 :1y |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/'], getreg(0,1,1)) |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 :.y |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/'], getreg(0,1,1)) |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 :.+y |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/'], getreg(0,1,1)) |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 :.,.y |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/'], getreg(0,1,1)) |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 :sil .1,.y |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/'], getreg(0,1,1)) |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 " use silent to make E493 go away |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 :sil .+,.y |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/'], getreg(0,1,1)) |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 :,y |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/'], getreg(0,1,1)) |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 :,+y |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/','after fold 1'], getreg(0,1,1)) |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 " using .+3 as second address should copy the whole folded line + the next 3 |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 " lines |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 :.,+3y |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/', |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 \ 'after fold 1', 'after fold 2', 'after fold 3'], getreg(0,1,1)) |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 :sil .,-2y |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/'], getreg(0,1,1)) |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 " now test again with folding disabled |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 set nofoldenable |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 :1y |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 call assert_equal(['int FuncName() {/*{{{*/'], getreg(0,1,1)) |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 :.y |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 call assert_equal(['int FuncName() {/*{{{*/'], getreg(0,1,1)) |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 :.+y |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 call assert_equal(['1'], getreg(0,1,1)) |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 :.,.y |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 call assert_equal(['int FuncName() {/*{{{*/'], getreg(0,1,1)) |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 " use silent to make E493 go away |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 :sil .1,.y |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 call assert_equal(['int FuncName() {/*{{{*/', '1'], getreg(0,1,1)) |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 " use silent to make E493 go away |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 :sil .+,.y |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 call assert_equal(['int FuncName() {/*{{{*/', '1'], getreg(0,1,1)) |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 :,y |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 call assert_equal(['int FuncName() {/*{{{*/'], getreg(0,1,1)) |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 :,+y |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 call assert_equal(['int FuncName() {/*{{{*/', '1'], getreg(0,1,1)) |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 " using .+3 as second address should copy the whole folded line + the next 3 |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 " lines |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 :.,+3y |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3'], getreg(0,1,1)) |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 :7 |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 :sil .,-2y |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 call assert_equal(['4', '5', '}/*}}}*/'], getreg(0,1,1)) |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
71 |
c7de1536780a
commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 quit! |
10998
2645a98217fa
patch 8.0.0388: filtering lines changes folds
Christian Brabandt <cb@256bit.org>
parents:
10486
diff
changeset
|
73 endfunc |
10486
99896ee0cac5
commit https://github.com/vim/vim/commit/54b2bfa399017ebae76ed62f21578261d1b55c1f
Christian Brabandt <cb@256bit.org>
parents:
10484
diff
changeset
|
74 |
11392
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
75 func Test_indent_fold() |
10486
99896ee0cac5
commit https://github.com/vim/vim/commit/54b2bfa399017ebae76ed62f21578261d1b55c1f
Christian Brabandt <cb@256bit.org>
parents:
10484
diff
changeset
|
76 new |
99896ee0cac5
commit https://github.com/vim/vim/commit/54b2bfa399017ebae76ed62f21578261d1b55c1f
Christian Brabandt <cb@256bit.org>
parents:
10484
diff
changeset
|
77 call setline(1, ['', 'a', ' b', ' c']) |
99896ee0cac5
commit https://github.com/vim/vim/commit/54b2bfa399017ebae76ed62f21578261d1b55c1f
Christian Brabandt <cb@256bit.org>
parents:
10484
diff
changeset
|
78 setl fen fdm=indent |
99896ee0cac5
commit https://github.com/vim/vim/commit/54b2bfa399017ebae76ed62f21578261d1b55c1f
Christian Brabandt <cb@256bit.org>
parents:
10484
diff
changeset
|
79 2 |
99896ee0cac5
commit https://github.com/vim/vim/commit/54b2bfa399017ebae76ed62f21578261d1b55c1f
Christian Brabandt <cb@256bit.org>
parents:
10484
diff
changeset
|
80 norm! >> |
99896ee0cac5
commit https://github.com/vim/vim/commit/54b2bfa399017ebae76ed62f21578261d1b55c1f
Christian Brabandt <cb@256bit.org>
parents:
10484
diff
changeset
|
81 let a=map(range(1,4), 'foldclosed(v:val)') |
99896ee0cac5
commit https://github.com/vim/vim/commit/54b2bfa399017ebae76ed62f21578261d1b55c1f
Christian Brabandt <cb@256bit.org>
parents:
10484
diff
changeset
|
82 call assert_equal([-1,-1,-1,-1], a) |
99896ee0cac5
commit https://github.com/vim/vim/commit/54b2bfa399017ebae76ed62f21578261d1b55c1f
Christian Brabandt <cb@256bit.org>
parents:
10484
diff
changeset
|
83 bw! |
10998
2645a98217fa
patch 8.0.0388: filtering lines changes folds
Christian Brabandt <cb@256bit.org>
parents:
10486
diff
changeset
|
84 endfunc |
10486
99896ee0cac5
commit https://github.com/vim/vim/commit/54b2bfa399017ebae76ed62f21578261d1b55c1f
Christian Brabandt <cb@256bit.org>
parents:
10484
diff
changeset
|
85 |
11392
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
86 func Test_indent_fold2() |
10486
99896ee0cac5
commit https://github.com/vim/vim/commit/54b2bfa399017ebae76ed62f21578261d1b55c1f
Christian Brabandt <cb@256bit.org>
parents:
10484
diff
changeset
|
87 new |
99896ee0cac5
commit https://github.com/vim/vim/commit/54b2bfa399017ebae76ed62f21578261d1b55c1f
Christian Brabandt <cb@256bit.org>
parents:
10484
diff
changeset
|
88 call setline(1, ['', '{{{', '}}}', '{{{', '}}}']) |
99896ee0cac5
commit https://github.com/vim/vim/commit/54b2bfa399017ebae76ed62f21578261d1b55c1f
Christian Brabandt <cb@256bit.org>
parents:
10484
diff
changeset
|
89 setl fen fdm=marker |
99896ee0cac5
commit https://github.com/vim/vim/commit/54b2bfa399017ebae76ed62f21578261d1b55c1f
Christian Brabandt <cb@256bit.org>
parents:
10484
diff
changeset
|
90 2 |
99896ee0cac5
commit https://github.com/vim/vim/commit/54b2bfa399017ebae76ed62f21578261d1b55c1f
Christian Brabandt <cb@256bit.org>
parents:
10484
diff
changeset
|
91 norm! >> |
17849
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17787
diff
changeset
|
92 let a=map(range(1,5), 'v:val->foldclosed()') |
10486
99896ee0cac5
commit https://github.com/vim/vim/commit/54b2bfa399017ebae76ed62f21578261d1b55c1f
Christian Brabandt <cb@256bit.org>
parents:
10484
diff
changeset
|
93 call assert_equal([-1,-1,-1,4,4], a) |
99896ee0cac5
commit https://github.com/vim/vim/commit/54b2bfa399017ebae76ed62f21578261d1b55c1f
Christian Brabandt <cb@256bit.org>
parents:
10484
diff
changeset
|
94 bw! |
10998
2645a98217fa
patch 8.0.0388: filtering lines changes folds
Christian Brabandt <cb@256bit.org>
parents:
10486
diff
changeset
|
95 endfunc |
2645a98217fa
patch 8.0.0388: filtering lines changes folds
Christian Brabandt <cb@256bit.org>
parents:
10486
diff
changeset
|
96 |
2645a98217fa
patch 8.0.0388: filtering lines changes folds
Christian Brabandt <cb@256bit.org>
parents:
10486
diff
changeset
|
97 func Test_manual_fold_with_filter() |
23027
f74978697fb6
patch 8.2.2060: check for features implemented with "if"
Bram Moolenaar <Bram@vim.org>
parents:
22850
diff
changeset
|
98 CheckExecutable cat |
11036
9861e4196c43
patch 8.0.0407: filtering folds with marker method not tested
Christian Brabandt <cb@256bit.org>
parents:
10998
diff
changeset
|
99 for type in ['manual', 'marker'] |
9861e4196c43
patch 8.0.0407: filtering folds with marker method not tested
Christian Brabandt <cb@256bit.org>
parents:
10998
diff
changeset
|
100 exe 'set foldmethod=' . type |
9861e4196c43
patch 8.0.0407: filtering folds with marker method not tested
Christian Brabandt <cb@256bit.org>
parents:
10998
diff
changeset
|
101 new |
9861e4196c43
patch 8.0.0407: filtering folds with marker method not tested
Christian Brabandt <cb@256bit.org>
parents:
10998
diff
changeset
|
102 call setline(1, range(1, 20)) |
9861e4196c43
patch 8.0.0407: filtering folds with marker method not tested
Christian Brabandt <cb@256bit.org>
parents:
10998
diff
changeset
|
103 4,$fold |
9861e4196c43
patch 8.0.0407: filtering folds with marker method not tested
Christian Brabandt <cb@256bit.org>
parents:
10998
diff
changeset
|
104 %foldopen |
9861e4196c43
patch 8.0.0407: filtering folds with marker method not tested
Christian Brabandt <cb@256bit.org>
parents:
10998
diff
changeset
|
105 10,$fold |
9861e4196c43
patch 8.0.0407: filtering folds with marker method not tested
Christian Brabandt <cb@256bit.org>
parents:
10998
diff
changeset
|
106 %foldopen |
9861e4196c43
patch 8.0.0407: filtering folds with marker method not tested
Christian Brabandt <cb@256bit.org>
parents:
10998
diff
changeset
|
107 " This filter command should not have an effect |
9861e4196c43
patch 8.0.0407: filtering folds with marker method not tested
Christian Brabandt <cb@256bit.org>
parents:
10998
diff
changeset
|
108 1,8! cat |
9861e4196c43
patch 8.0.0407: filtering folds with marker method not tested
Christian Brabandt <cb@256bit.org>
parents:
10998
diff
changeset
|
109 call feedkeys('5ggzdzMGdd', 'xt') |
9861e4196c43
patch 8.0.0407: filtering folds with marker method not tested
Christian Brabandt <cb@256bit.org>
parents:
10998
diff
changeset
|
110 call assert_equal(['1', '2', '3', '4', '5', '6', '7', '8', '9'], getline(1, '$')) |
9861e4196c43
patch 8.0.0407: filtering folds with marker method not tested
Christian Brabandt <cb@256bit.org>
parents:
10998
diff
changeset
|
111 |
9861e4196c43
patch 8.0.0407: filtering folds with marker method not tested
Christian Brabandt <cb@256bit.org>
parents:
10998
diff
changeset
|
112 bwipe! |
9861e4196c43
patch 8.0.0407: filtering folds with marker method not tested
Christian Brabandt <cb@256bit.org>
parents:
10998
diff
changeset
|
113 set foldmethod& |
9861e4196c43
patch 8.0.0407: filtering folds with marker method not tested
Christian Brabandt <cb@256bit.org>
parents:
10998
diff
changeset
|
114 endfor |
10998
2645a98217fa
patch 8.0.0388: filtering lines changes folds
Christian Brabandt <cb@256bit.org>
parents:
10486
diff
changeset
|
115 endfunc |
11038
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
116 |
11392
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
117 func Test_indent_fold_with_read() |
11038
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
118 new |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
119 set foldmethod=indent |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
120 call setline(1, repeat(["\<Tab>a"], 4)) |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
121 for n in range(1, 4) |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
122 call assert_equal(1, foldlevel(n)) |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
123 endfor |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
124 |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
125 call writefile(["a", "", "\<Tab>a"], 'Xfile') |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
126 foldopen |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
127 2read Xfile |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
128 %foldclose |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
129 call assert_equal(1, foldlevel(1)) |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
130 call assert_equal(2, foldclosedend(1)) |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
131 call assert_equal(0, foldlevel(3)) |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
132 call assert_equal(0, foldlevel(4)) |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
133 call assert_equal(1, foldlevel(5)) |
17849
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17787
diff
changeset
|
134 call assert_equal(7, 5->foldclosedend()) |
11038
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
135 |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
136 bwipe! |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
137 set foldmethod& |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
138 call delete('Xfile') |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
139 endfunc |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
140 |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
141 func Test_combining_folds_indent() |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
142 new |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
143 let one = "\<Tab>a" |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
144 let zero = 'a' |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
145 call setline(1, [one, one, zero, zero, zero, one, one, one]) |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
146 set foldmethod=indent |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
147 3,5d |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
148 %foldclose |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
149 call assert_equal(5, foldclosedend(1)) |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
150 |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
151 set foldmethod& |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
152 bwipe! |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
153 endfunc |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
154 |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
155 func Test_combining_folds_marker() |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
156 new |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
157 call setline(1, ['{{{', '}}}', '', '', '', '{{{', '', '}}}']) |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
158 set foldmethod=marker |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
159 3,5d |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
160 %foldclose |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
161 call assert_equal(2, foldclosedend(1)) |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
162 |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
163 set foldmethod& |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
164 bwipe! |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
165 endfunc |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
166 |
11131
8d9ecf09183a
patch 8.0.0453: adding fold marker creates new comment
Christian Brabandt <cb@256bit.org>
parents:
11038
diff
changeset
|
167 func Test_folds_marker_in_comment() |
8d9ecf09183a
patch 8.0.0453: adding fold marker creates new comment
Christian Brabandt <cb@256bit.org>
parents:
11038
diff
changeset
|
168 new |
8d9ecf09183a
patch 8.0.0453: adding fold marker creates new comment
Christian Brabandt <cb@256bit.org>
parents:
11038
diff
changeset
|
169 call setline(1, ['" foo', 'bar', 'baz']) |
8d9ecf09183a
patch 8.0.0453: adding fold marker creates new comment
Christian Brabandt <cb@256bit.org>
parents:
11038
diff
changeset
|
170 setl fen fdm=marker |
8d9ecf09183a
patch 8.0.0453: adding fold marker creates new comment
Christian Brabandt <cb@256bit.org>
parents:
11038
diff
changeset
|
171 setl com=sO:\"\ -,mO:\"\ \ ,eO:\"\",:\" cms=\"%s |
8d9ecf09183a
patch 8.0.0453: adding fold marker creates new comment
Christian Brabandt <cb@256bit.org>
parents:
11038
diff
changeset
|
172 norm! zf2j |
8d9ecf09183a
patch 8.0.0453: adding fold marker creates new comment
Christian Brabandt <cb@256bit.org>
parents:
11038
diff
changeset
|
173 setl nofen |
8d9ecf09183a
patch 8.0.0453: adding fold marker creates new comment
Christian Brabandt <cb@256bit.org>
parents:
11038
diff
changeset
|
174 :1y |
8d9ecf09183a
patch 8.0.0453: adding fold marker creates new comment
Christian Brabandt <cb@256bit.org>
parents:
11038
diff
changeset
|
175 call assert_equal(['" foo{{{'], getreg(0,1,1)) |
8d9ecf09183a
patch 8.0.0453: adding fold marker creates new comment
Christian Brabandt <cb@256bit.org>
parents:
11038
diff
changeset
|
176 :+2y |
8d9ecf09183a
patch 8.0.0453: adding fold marker creates new comment
Christian Brabandt <cb@256bit.org>
parents:
11038
diff
changeset
|
177 call assert_equal(['baz"}}}'], getreg(0,1,1)) |
8d9ecf09183a
patch 8.0.0453: adding fold marker creates new comment
Christian Brabandt <cb@256bit.org>
parents:
11038
diff
changeset
|
178 |
8d9ecf09183a
patch 8.0.0453: adding fold marker creates new comment
Christian Brabandt <cb@256bit.org>
parents:
11038
diff
changeset
|
179 set foldmethod& |
8d9ecf09183a
patch 8.0.0453: adding fold marker creates new comment
Christian Brabandt <cb@256bit.org>
parents:
11038
diff
changeset
|
180 bwipe! |
8d9ecf09183a
patch 8.0.0453: adding fold marker creates new comment
Christian Brabandt <cb@256bit.org>
parents:
11038
diff
changeset
|
181 endfunc |
8d9ecf09183a
patch 8.0.0453: adding fold marker creates new comment
Christian Brabandt <cb@256bit.org>
parents:
11038
diff
changeset
|
182 |
11038
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
183 func s:TestFoldExpr(lnum) |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
184 let thisline = getline(a:lnum) |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
185 if thisline == 'a' |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
186 return 1 |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
187 elseif thisline == 'b' |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
188 return 0 |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
189 elseif thisline == 'c' |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
190 return '<1' |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
191 elseif thisline == 'd' |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
192 return '>1' |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
193 endif |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
194 return 0 |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
195 endfunction |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
196 |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
197 func Test_update_folds_expr_read() |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
198 new |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
199 call setline(1, ['a', 'a', 'a', 'a', 'a', 'a']) |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
200 set foldmethod=expr |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
201 set foldexpr=s:TestFoldExpr(v:lnum) |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
202 2 |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
203 foldopen |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
204 call writefile(['b', 'b', 'a', 'a', 'd', 'a', 'a', 'c'], 'Xfile') |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
205 read Xfile |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
206 %foldclose |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
207 call assert_equal(2, foldclosedend(1)) |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
208 call assert_equal(0, foldlevel(3)) |
17849
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17787
diff
changeset
|
209 call assert_equal(0, 4->foldlevel()) |
11038
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
210 call assert_equal(6, foldclosedend(5)) |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
211 call assert_equal(10, foldclosedend(7)) |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
212 call assert_equal(14, foldclosedend(11)) |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
213 |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
214 call delete('Xfile') |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
215 bwipe! |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
216 set foldmethod& foldexpr& |
c8b49300c6b7
patch 8.0.0408: updating folds does not always work properly
Christian Brabandt <cb@256bit.org>
parents:
11036
diff
changeset
|
217 endfunc |
11140
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
218 |
11392
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
219 func Check_foldlevels(expected) |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
220 call assert_equal(a:expected, map(range(1, line('$')), 'foldlevel(v:val)')) |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
221 endfunc |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
222 |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
223 func Test_move_folds_around_manual() |
11140
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
224 new |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
225 let input = PrepIndent("a") + PrepIndent("b") + PrepIndent("c") |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
226 call setline(1, PrepIndent("a") + PrepIndent("b") + PrepIndent("c")) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
227 let folds=[-1, 2, 2, 2, 2, 2, -1, 8, 8, 8, 8, 8, -1, 14, 14, 14, 14, 14] |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
228 " all folds closed |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
229 set foldenable foldlevel=0 fdm=indent |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
230 " needs a forced redraw |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
231 redraw! |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
232 set fdm=manual |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
233 call assert_equal(folds, map(range(1, line('$')), 'foldclosed(v:val)')) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
234 call assert_equal(input, getline(1, '$')) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
235 7,12m0 |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
236 call assert_equal(PrepIndent("b") + PrepIndent("a") + PrepIndent("c"), getline(1, '$')) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
237 call assert_equal(folds, map(range(1, line('$')), 'foldclosed(v:val)')) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
238 10,12m0 |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
239 call assert_equal(PrepIndent("a")[1:] + PrepIndent("b") + ["a"] + PrepIndent("c"), getline(1, '$')) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
240 call assert_equal([1, 1, 1, 1, 1, -1, 7, 7, 7, 7, 7, -1, -1, 14, 14, 14, 14, 14], map(range(1, line('$')), 'foldclosed(v:val)')) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
241 " moving should not close the folds |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
242 %d |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
243 call setline(1, PrepIndent("a") + PrepIndent("b") + PrepIndent("c")) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
244 set fdm=indent |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
245 redraw! |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
246 set fdm=manual |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
247 call cursor(2, 1) |
11156
80241603dd50
patch 8.0.0465: off-by-one error in using :move with folding
Christian Brabandt <cb@256bit.org>
parents:
11140
diff
changeset
|
248 %foldopen |
11140
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
249 7,12m0 |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
250 let folds=repeat([-1], 18) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
251 call assert_equal(PrepIndent("b") + PrepIndent("a") + PrepIndent("c"), getline(1, '$')) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
252 call assert_equal(folds, map(range(1, line('$')), 'foldclosed(v:val)')) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
253 norm! zM |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
254 " folds are not corrupted and all have been closed |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
255 call assert_equal([-1, 2, 2, 2, 2, 2, -1, 8, 8, 8, 8, 8, -1, 14, 14, 14, 14, 14], map(range(1, line('$')), 'foldclosed(v:val)')) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
256 %d |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
257 call setline(1, ["a", "\tb", "\tc", "\td", "\te"]) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
258 set fdm=indent |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
259 redraw! |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
260 set fdm=manual |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
261 %foldopen |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
262 3m4 |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
263 %foldclose |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
264 call assert_equal(["a", "\tb", "\td", "\tc", "\te"], getline(1, '$')) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
265 call assert_equal([-1, 5, 5, 5, 5], map(range(1, line('$')), 'foldclosedend(v:val)')) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
266 %d |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
267 call setline(1, ["a", "\tb", "\tc", "\td", "\te", "z", "\ty", "\tx", "\tw", "\tv"]) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
268 set fdm=indent foldlevel=0 |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
269 set fdm=manual |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
270 %foldopen |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
271 3m1 |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
272 %foldclose |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
273 call assert_equal(["a", "\tc", "\tb", "\td", "\te", "z", "\ty", "\tx", "\tw", "\tv"], getline(1, '$')) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
274 call assert_equal(0, foldlevel(2)) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
275 call assert_equal(5, foldclosedend(3)) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
276 call assert_equal([-1, -1, 3, 3, 3, -1, 7, 7, 7, 7], map(range(1, line('$')), 'foldclosed(v:val)')) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
277 2,6m$ |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
278 %foldclose |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
279 call assert_equal(5, foldclosedend(2)) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
280 call assert_equal(0, foldlevel(6)) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
281 call assert_equal(9, foldclosedend(7)) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
282 call assert_equal([-1, 2, 2, 2, 2, -1, 7, 7, 7, -1], map(range(1, line('$')), 'foldclosed(v:val)')) |
12471
f6534b99b76f
patch 8.0.1115: crash when using foldtextresult() recursively
Christian Brabandt <cb@256bit.org>
parents:
11392
diff
changeset
|
283 |
11156
80241603dd50
patch 8.0.0465: off-by-one error in using :move with folding
Christian Brabandt <cb@256bit.org>
parents:
11140
diff
changeset
|
284 %d |
80241603dd50
patch 8.0.0465: off-by-one error in using :move with folding
Christian Brabandt <cb@256bit.org>
parents:
11140
diff
changeset
|
285 " Ensure moving around the edges still works. |
80241603dd50
patch 8.0.0465: off-by-one error in using :move with folding
Christian Brabandt <cb@256bit.org>
parents:
11140
diff
changeset
|
286 call setline(1, PrepIndent("a") + repeat(["a"], 3) + ["\ta"]) |
80241603dd50
patch 8.0.0465: off-by-one error in using :move with folding
Christian Brabandt <cb@256bit.org>
parents:
11140
diff
changeset
|
287 set fdm=indent foldlevel=0 |
80241603dd50
patch 8.0.0465: off-by-one error in using :move with folding
Christian Brabandt <cb@256bit.org>
parents:
11140
diff
changeset
|
288 set fdm=manual |
80241603dd50
patch 8.0.0465: off-by-one error in using :move with folding
Christian Brabandt <cb@256bit.org>
parents:
11140
diff
changeset
|
289 %foldopen |
80241603dd50
patch 8.0.0465: off-by-one error in using :move with folding
Christian Brabandt <cb@256bit.org>
parents:
11140
diff
changeset
|
290 6m$ |
80241603dd50
patch 8.0.0465: off-by-one error in using :move with folding
Christian Brabandt <cb@256bit.org>
parents:
11140
diff
changeset
|
291 " The first fold has been truncated to the 5'th line. |
80241603dd50
patch 8.0.0465: off-by-one error in using :move with folding
Christian Brabandt <cb@256bit.org>
parents:
11140
diff
changeset
|
292 " Second fold has been moved up because the moved line is now below it. |
11392
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
293 call Check_foldlevels([0, 1, 1, 1, 1, 0, 0, 0, 1, 0]) |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
294 |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
295 %delete |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
296 set fdm=indent foldlevel=0 |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
297 call setline(1, [ |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
298 \ "a", |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
299 \ "\ta", |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
300 \ "\t\ta", |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
301 \ "\t\ta", |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
302 \ "\t\ta", |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
303 \ "a", |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
304 \ "a"]) |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
305 set fdm=manual |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
306 %foldopen! |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
307 4,5m6 |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
308 call Check_foldlevels([0, 1, 2, 0, 0, 0, 0]) |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
309 |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
310 %delete |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
311 set fdm=indent |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
312 call setline(1, [ |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
313 \ "\ta", |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
314 \ "\t\ta", |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
315 \ "\t\ta", |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
316 \ "\t\ta", |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
317 \ "\ta", |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
318 \ "\t\ta", |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
319 \ "\t\ta", |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
320 \ "\t\ta", |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
321 \ "\ta", |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
322 \ "\t\ta", |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
323 \ "\t\ta", |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
324 \ "\t\ta", |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
325 \ "\t\ta", |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
326 \ "\ta", |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
327 \ "a"]) |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
328 set fdm=manual |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
329 %foldopen! |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
330 13m7 |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
331 call Check_foldlevels([1, 2, 2, 2, 1, 2, 2, 1, 1, 1, 2, 2, 2, 1, 0]) |
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
332 |
11140
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
333 bw! |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
334 endfunc |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
335 |
11392
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
336 func Test_move_folds_around_indent() |
11140
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
337 new |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
338 let input = PrepIndent("a") + PrepIndent("b") + PrepIndent("c") |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
339 call setline(1, PrepIndent("a") + PrepIndent("b") + PrepIndent("c")) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
340 let folds=[-1, 2, 2, 2, 2, 2, -1, 8, 8, 8, 8, 8, -1, 14, 14, 14, 14, 14] |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
341 " all folds closed |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
342 set fdm=indent |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
343 call assert_equal(folds, map(range(1, line('$')), 'foldclosed(v:val)')) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
344 call assert_equal(input, getline(1, '$')) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
345 7,12m0 |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
346 call assert_equal(PrepIndent("b") + PrepIndent("a") + PrepIndent("c"), getline(1, '$')) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
347 call assert_equal(folds, map(range(1, line('$')), 'foldclosed(v:val)')) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
348 10,12m0 |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
349 call assert_equal(PrepIndent("a")[1:] + PrepIndent("b") + ["a"] + PrepIndent("c"), getline(1, '$')) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
350 call assert_equal([1, 1, 1, 1, 1, -1, 7, 7, 7, 7, 7, -1, -1, 14, 14, 14, 14, 14], map(range(1, line('$')), 'foldclosed(v:val)')) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
351 " moving should not close the folds |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
352 %d |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
353 call setline(1, PrepIndent("a") + PrepIndent("b") + PrepIndent("c")) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
354 set fdm=indent |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
355 call cursor(2, 1) |
11156
80241603dd50
patch 8.0.0465: off-by-one error in using :move with folding
Christian Brabandt <cb@256bit.org>
parents:
11140
diff
changeset
|
356 %foldopen |
11140
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
357 7,12m0 |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
358 let folds=repeat([-1], 18) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
359 call assert_equal(PrepIndent("b") + PrepIndent("a") + PrepIndent("c"), getline(1, '$')) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
360 call assert_equal(folds, map(range(1, line('$')), 'foldclosed(v:val)')) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
361 norm! zM |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
362 " folds are not corrupted and all have been closed |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
363 call assert_equal([-1, 2, 2, 2, 2, 2, -1, 8, 8, 8, 8, 8, -1, 14, 14, 14, 14, 14], map(range(1, line('$')), 'foldclosed(v:val)')) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
364 %d |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
365 call setline(1, ["a", "\tb", "\tc", "\td", "\te"]) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
366 set fdm=indent |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
367 %foldopen |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
368 3m4 |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
369 %foldclose |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
370 call assert_equal(["a", "\tb", "\td", "\tc", "\te"], getline(1, '$')) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
371 call assert_equal([-1, 5, 5, 5, 5], map(range(1, line('$')), 'foldclosedend(v:val)')) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
372 %d |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
373 call setline(1, ["a", "\tb", "\tc", "\td", "\te", "z", "\ty", "\tx", "\tw", "\tv"]) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
374 set fdm=indent foldlevel=0 |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
375 %foldopen |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
376 3m1 |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
377 %foldclose |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
378 call assert_equal(["a", "\tc", "\tb", "\td", "\te", "z", "\ty", "\tx", "\tw", "\tv"], getline(1, '$')) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
379 call assert_equal(1, foldlevel(2)) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
380 call assert_equal(5, foldclosedend(3)) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
381 call assert_equal([-1, 2, 2, 2, 2, -1, 7, 7, 7, 7], map(range(1, line('$')), 'foldclosed(v:val)')) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
382 2,6m$ |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
383 %foldclose |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
384 call assert_equal(9, foldclosedend(2)) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
385 call assert_equal(1, foldlevel(6)) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
386 call assert_equal(9, foldclosedend(7)) |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
387 call assert_equal([-1, 2, 2, 2, 2, 2, 2, 2, 2, -1], map(range(1, line('$')), 'foldclosed(v:val)')) |
11156
80241603dd50
patch 8.0.0465: off-by-one error in using :move with folding
Christian Brabandt <cb@256bit.org>
parents:
11140
diff
changeset
|
388 " Ensure moving around the edges still works. |
80241603dd50
patch 8.0.0465: off-by-one error in using :move with folding
Christian Brabandt <cb@256bit.org>
parents:
11140
diff
changeset
|
389 %d |
80241603dd50
patch 8.0.0465: off-by-one error in using :move with folding
Christian Brabandt <cb@256bit.org>
parents:
11140
diff
changeset
|
390 call setline(1, PrepIndent("a") + repeat(["a"], 3) + ["\ta"]) |
80241603dd50
patch 8.0.0465: off-by-one error in using :move with folding
Christian Brabandt <cb@256bit.org>
parents:
11140
diff
changeset
|
391 set fdm=indent foldlevel=0 |
80241603dd50
patch 8.0.0465: off-by-one error in using :move with folding
Christian Brabandt <cb@256bit.org>
parents:
11140
diff
changeset
|
392 %foldopen |
80241603dd50
patch 8.0.0465: off-by-one error in using :move with folding
Christian Brabandt <cb@256bit.org>
parents:
11140
diff
changeset
|
393 6m$ |
80241603dd50
patch 8.0.0465: off-by-one error in using :move with folding
Christian Brabandt <cb@256bit.org>
parents:
11140
diff
changeset
|
394 " The first fold has been truncated to the 5'th line. |
80241603dd50
patch 8.0.0465: off-by-one error in using :move with folding
Christian Brabandt <cb@256bit.org>
parents:
11140
diff
changeset
|
395 " Second fold has been moved up because the moved line is now below it. |
11392
dc2800c3572b
patch 8.0.0581: moving folded text is sometimes not correct
Christian Brabandt <cb@256bit.org>
parents:
11219
diff
changeset
|
396 call Check_foldlevels([0, 1, 1, 1, 1, 0, 0, 0, 1, 1]) |
11140
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
397 bw! |
6b26e044b6f5
patch 8.0.0457: using :move messes up manual folds
Christian Brabandt <cb@256bit.org>
parents:
11131
diff
changeset
|
398 endfunc |
11219
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
399 |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
400 func Test_folddoopen_folddoclosed() |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
401 new |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
402 call setline(1, range(1, 9)) |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
403 set foldmethod=manual |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
404 1,3 fold |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
405 6,8 fold |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
406 |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
407 " Test without range. |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
408 folddoopen s/$/o/ |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
409 folddoclosed s/$/c/ |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
410 call assert_equal(['1c', '2c', '3c', |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
411 \ '4o', '5o', |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
412 \ '6c', '7c', '8c', |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
413 \ '9o'], getline(1, '$')) |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
414 |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
415 " Test with range. |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
416 call setline(1, range(1, 9)) |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
417 1,8 folddoopen s/$/o/ |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
418 4,$ folddoclosed s/$/c/ |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
419 call assert_equal(['1', '2', '3', |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
420 \ '4o', '5o', |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
421 \ '6c', '7c', '8c', |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
422 \ '9'], getline(1, '$')) |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
423 |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
424 set foldmethod& |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
425 bw! |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
426 endfunc |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
427 |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
428 func Test_fold_error() |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
429 new |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
430 call setline(1, [1, 2]) |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
431 |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
432 for fm in ['indent', 'expr', 'syntax', 'diff'] |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
433 exe 'set foldmethod=' . fm |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
434 call assert_fails('norm zf', 'E350:') |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
435 call assert_fails('norm zd', 'E351:') |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
436 call assert_fails('norm zE', 'E352:') |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
437 endfor |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
438 |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
439 set foldmethod=manual |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
440 call assert_fails('norm zd', 'E490:') |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
441 call assert_fails('norm zo', 'E490:') |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
442 call assert_fails('3fold', 'E16:') |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
443 |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
444 set foldmethod=marker |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
445 set nomodifiable |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
446 call assert_fails('1,2fold', 'E21:') |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
447 |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
448 set modifiable& |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
449 set foldmethod& |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
450 bw! |
e53609585b76
patch 8.0.0496: insufficient testing for folding
Christian Brabandt <cb@256bit.org>
parents:
11156
diff
changeset
|
451 endfunc |
12471
f6534b99b76f
patch 8.0.1115: crash when using foldtextresult() recursively
Christian Brabandt <cb@256bit.org>
parents:
11392
diff
changeset
|
452 |
f6534b99b76f
patch 8.0.1115: crash when using foldtextresult() recursively
Christian Brabandt <cb@256bit.org>
parents:
11392
diff
changeset
|
453 func Test_foldtext_recursive() |
f6534b99b76f
patch 8.0.1115: crash when using foldtextresult() recursively
Christian Brabandt <cb@256bit.org>
parents:
11392
diff
changeset
|
454 new |
f6534b99b76f
patch 8.0.1115: crash when using foldtextresult() recursively
Christian Brabandt <cb@256bit.org>
parents:
11392
diff
changeset
|
455 call setline(1, ['{{{', 'some text', '}}}']) |
f6534b99b76f
patch 8.0.1115: crash when using foldtextresult() recursively
Christian Brabandt <cb@256bit.org>
parents:
11392
diff
changeset
|
456 setlocal foldenable foldmethod=marker foldtext=foldtextresult(v\:foldstart) |
f6534b99b76f
patch 8.0.1115: crash when using foldtextresult() recursively
Christian Brabandt <cb@256bit.org>
parents:
11392
diff
changeset
|
457 " This was crashing because of endless recursion. |
f6534b99b76f
patch 8.0.1115: crash when using foldtextresult() recursively
Christian Brabandt <cb@256bit.org>
parents:
11392
diff
changeset
|
458 2foldclose |
f6534b99b76f
patch 8.0.1115: crash when using foldtextresult() recursively
Christian Brabandt <cb@256bit.org>
parents:
11392
diff
changeset
|
459 redraw |
f6534b99b76f
patch 8.0.1115: crash when using foldtextresult() recursively
Christian Brabandt <cb@256bit.org>
parents:
11392
diff
changeset
|
460 call assert_equal(1, foldlevel(2)) |
f6534b99b76f
patch 8.0.1115: crash when using foldtextresult() recursively
Christian Brabandt <cb@256bit.org>
parents:
11392
diff
changeset
|
461 call assert_equal(1, foldclosed(2)) |
f6534b99b76f
patch 8.0.1115: crash when using foldtextresult() recursively
Christian Brabandt <cb@256bit.org>
parents:
11392
diff
changeset
|
462 call assert_equal(3, foldclosedend(2)) |
f6534b99b76f
patch 8.0.1115: crash when using foldtextresult() recursively
Christian Brabandt <cb@256bit.org>
parents:
11392
diff
changeset
|
463 bwipe! |
f6534b99b76f
patch 8.0.1115: crash when using foldtextresult() recursively
Christian Brabandt <cb@256bit.org>
parents:
11392
diff
changeset
|
464 endfunc |
12750
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
465 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
466 " Various fold related tests |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
467 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
468 " Basic test if a fold can be created, opened, moving to the end and closed |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
469 func Test_fold_manual() |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
470 enew! |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
471 set fdm=manual |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
472 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
473 let content = ['1 aa', '2 bb', '3 cc'] |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
474 call append(0, content) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
475 call cursor(1, 1) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
476 normal zf2j |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
477 call assert_equal('1 aa', getline(foldclosed('.'))) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
478 normal zo |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
479 call assert_equal(-1, foldclosed('.')) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
480 normal ]z |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
481 call assert_equal('3 cc', getline('.')) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
482 normal zc |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
483 call assert_equal('1 aa', getline(foldclosed('.'))) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
484 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
485 set fdm& |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
486 enew! |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
487 endfunc |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
488 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
489 " test folding with markers. |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
490 func Test_fold_marker() |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
491 enew! |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
492 set fdm=marker fdl=1 fdc=3 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
493 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
494 let content = ['4 dd {{{', '5 ee {{{ }}}', '6 ff }}}'] |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
495 call append(0, content) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
496 call cursor(2, 1) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
497 call assert_equal(2, foldlevel('.')) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
498 normal [z |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
499 call assert_equal(1, foldlevel('.')) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
500 exe "normal jo{{ \<Esc>r{jj" |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
501 call assert_equal(1, foldlevel('.')) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
502 normal kYpj |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
503 call assert_equal(0, foldlevel('.')) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
504 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
505 set fdm& fdl& fdc& |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
506 enew! |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
507 endfunc |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
508 |
15127
31a0127813cb
patch 8.1.0574: 'commentstring' not used when adding fold marker in C
Bram Moolenaar <Bram@vim.org>
parents:
15119
diff
changeset
|
509 " test create fold markers with C filetype |
31a0127813cb
patch 8.1.0574: 'commentstring' not used when adding fold marker in C
Bram Moolenaar <Bram@vim.org>
parents:
15119
diff
changeset
|
510 func Test_fold_create_marker_in_C() |
31a0127813cb
patch 8.1.0574: 'commentstring' not used when adding fold marker in C
Bram Moolenaar <Bram@vim.org>
parents:
15119
diff
changeset
|
511 enew! |
31a0127813cb
patch 8.1.0574: 'commentstring' not used when adding fold marker in C
Bram Moolenaar <Bram@vim.org>
parents:
15119
diff
changeset
|
512 set fdm=marker fdl=9 |
31a0127813cb
patch 8.1.0574: 'commentstring' not used when adding fold marker in C
Bram Moolenaar <Bram@vim.org>
parents:
15119
diff
changeset
|
513 set filetype=c |
31a0127813cb
patch 8.1.0574: 'commentstring' not used when adding fold marker in C
Bram Moolenaar <Bram@vim.org>
parents:
15119
diff
changeset
|
514 |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
15127
diff
changeset
|
515 let content =<< trim [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
15127
diff
changeset
|
516 /* |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
15127
diff
changeset
|
517 * comment |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
15127
diff
changeset
|
518 * |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
15127
diff
changeset
|
519 * |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
15127
diff
changeset
|
520 */ |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
15127
diff
changeset
|
521 int f(int* p) { |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
15127
diff
changeset
|
522 *p = 3; |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
15127
diff
changeset
|
523 return 0; |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
15127
diff
changeset
|
524 } |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
15127
diff
changeset
|
525 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
15127
diff
changeset
|
526 |
15127
31a0127813cb
patch 8.1.0574: 'commentstring' not used when adding fold marker in C
Bram Moolenaar <Bram@vim.org>
parents:
15119
diff
changeset
|
527 for c in range(len(content) - 1) |
31a0127813cb
patch 8.1.0574: 'commentstring' not used when adding fold marker in C
Bram Moolenaar <Bram@vim.org>
parents:
15119
diff
changeset
|
528 bw! |
31a0127813cb
patch 8.1.0574: 'commentstring' not used when adding fold marker in C
Bram Moolenaar <Bram@vim.org>
parents:
15119
diff
changeset
|
529 call append(0, content) |
31a0127813cb
patch 8.1.0574: 'commentstring' not used when adding fold marker in C
Bram Moolenaar <Bram@vim.org>
parents:
15119
diff
changeset
|
530 call cursor(c + 1, 1) |
31a0127813cb
patch 8.1.0574: 'commentstring' not used when adding fold marker in C
Bram Moolenaar <Bram@vim.org>
parents:
15119
diff
changeset
|
531 norm! zfG |
31a0127813cb
patch 8.1.0574: 'commentstring' not used when adding fold marker in C
Bram Moolenaar <Bram@vim.org>
parents:
15119
diff
changeset
|
532 call assert_equal(content[c] . (c < 4 ? '{{{' : '/*{{{*/'), getline(c + 1)) |
31a0127813cb
patch 8.1.0574: 'commentstring' not used when adding fold marker in C
Bram Moolenaar <Bram@vim.org>
parents:
15119
diff
changeset
|
533 endfor |
31a0127813cb
patch 8.1.0574: 'commentstring' not used when adding fold marker in C
Bram Moolenaar <Bram@vim.org>
parents:
15119
diff
changeset
|
534 |
31a0127813cb
patch 8.1.0574: 'commentstring' not used when adding fold marker in C
Bram Moolenaar <Bram@vim.org>
parents:
15119
diff
changeset
|
535 set fdm& fdl& |
31a0127813cb
patch 8.1.0574: 'commentstring' not used when adding fold marker in C
Bram Moolenaar <Bram@vim.org>
parents:
15119
diff
changeset
|
536 enew! |
31a0127813cb
patch 8.1.0574: 'commentstring' not used when adding fold marker in C
Bram Moolenaar <Bram@vim.org>
parents:
15119
diff
changeset
|
537 endfunc |
31a0127813cb
patch 8.1.0574: 'commentstring' not used when adding fold marker in C
Bram Moolenaar <Bram@vim.org>
parents:
15119
diff
changeset
|
538 |
12750
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
539 " test folding with indent |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
540 func Test_fold_indent() |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
541 enew! |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
542 set fdm=indent sw=2 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
543 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
544 let content = ['1 aa', '2 bb', '3 cc'] |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
545 call append(0, content) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
546 call cursor(2, 1) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
547 exe "normal i \<Esc>jI " |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
548 call assert_equal(2, foldlevel('.')) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
549 normal k |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
550 call assert_equal(1, foldlevel('.')) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
551 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
552 set fdm& sw& |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
553 enew! |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
554 endfunc |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
555 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
556 " test syntax folding |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
557 func Test_fold_syntax() |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
20156
diff
changeset
|
558 CheckFeature syntax |
12750
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
559 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
560 enew! |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
561 set fdm=syntax fdl=0 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
562 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
563 syn region Hup start="dd" end="ii" fold contains=Fd1,Fd2,Fd3 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
564 syn region Fd1 start="ee" end="ff" fold contained |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
565 syn region Fd2 start="gg" end="hh" fold contained |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
566 syn region Fd3 start="commentstart" end="commentend" fold contained |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
567 let content = ['3 cc', '4 dd {{{', '5 ee {{{ }}}', '{{{{', '6 ff }}}', |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
568 \ '6 ff }}}', '7 gg', '8 hh', '9 ii'] |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
569 call append(0, content) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
570 normal Gzk |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
571 call assert_equal('9 ii', getline('.')) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
572 normal k |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
573 call assert_equal('3 cc', getline('.')) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
574 exe "normal jAcommentstart \<Esc>Acommentend" |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
575 set fdl=1 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
576 normal 3j |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
577 call assert_equal('7 gg', getline('.')) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
578 set fdl=0 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
579 exe "normal zO\<C-L>j" |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
580 call assert_equal('8 hh', getline('.')) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
581 syn clear Fd1 Fd2 Fd3 Hup |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
582 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
583 set fdm& fdl& |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
584 enew! |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
585 endfunc |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
586 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
587 func Flvl() |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
588 let l = getline(v:lnum) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
589 if l =~ "bb$" |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
590 return 2 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
591 elseif l =~ "gg$" |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
592 return "s1" |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
593 elseif l =~ "ii$" |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
594 return ">2" |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
595 elseif l =~ "kk$" |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
596 return "0" |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
597 endif |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
598 return "=" |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
599 endfun |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
600 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
601 " test expression folding |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
602 func Test_fold_expr() |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
603 enew! |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
604 set fdm=expr fde=Flvl() |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
605 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
606 let content = ['1 aa', |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
607 \ '2 bb', |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
608 \ '3 cc', |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
609 \ '4 dd {{{commentstart commentend', |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
610 \ '5 ee {{{ }}}', |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
611 \ '{{{', |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
612 \ '6 ff }}}', |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
613 \ '6 ff }}}', |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
614 \ ' 7 gg', |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
615 \ ' 8 hh', |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
616 \ '9 ii', |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
617 \ 'a jj', |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
618 \ 'b kk'] |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
619 call append(0, content) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
620 call cursor(1, 1) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
621 exe "normal /bb$\<CR>" |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
622 call assert_equal(2, foldlevel('.')) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
623 exe "normal /hh$\<CR>" |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
624 call assert_equal(1, foldlevel('.')) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
625 exe "normal /ii$\<CR>" |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
626 call assert_equal(2, foldlevel('.')) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
627 exe "normal /kk$\<CR>" |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
628 call assert_equal(0, foldlevel('.')) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
629 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
630 set fdm& fde& |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
631 enew! |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
632 endfunc |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
633 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
634 " Bug with fdm=indent and moving folds |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
635 " Moving a fold a few times, messes up the folds below the moved fold. |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
636 " Fixed by 7.4.700 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
637 func Test_fold_move() |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
638 enew! |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
639 set fdm=indent sw=2 fdl=0 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
640 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
641 let content = ['', '', 'Line1', ' Line2', ' Line3', |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
642 \ 'Line4', ' Line5', ' Line6', |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
643 \ 'Line7', ' Line8', ' Line9'] |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
644 call append(0, content) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
645 normal zM |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
646 call cursor(4, 1) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
647 move 2 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
648 move 1 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
649 call assert_equal(7, foldclosed(7)) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
650 call assert_equal(8, foldclosedend(7)) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
651 call assert_equal(0, foldlevel(9)) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
652 call assert_equal(10, foldclosed(10)) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
653 call assert_equal(11, foldclosedend(10)) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
654 call assert_equal('+-- 2 lines: Line2', foldtextresult(2)) |
17849
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17787
diff
changeset
|
655 call assert_equal('+-- 2 lines: Line8', 10->foldtextresult()) |
12750
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
656 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
657 set fdm& sw& fdl& |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
658 enew! |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12471
diff
changeset
|
659 endfunc |
12788
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
660 |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
661 " test for patch 7.3.637 |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
662 " Cannot catch the error caused by a foldopen when there is no fold. |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
663 func Test_foldopen_exception() |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
664 enew! |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
665 let a = 'No error caught' |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
666 try |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
667 foldopen |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
668 catch |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
669 let a = matchstr(v:exception,'^[^ ]*') |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
670 endtry |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
671 call assert_equal('Vim(foldopen):E490:', a) |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
672 |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
673 let a = 'No error caught' |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
674 try |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
675 foobar |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
676 catch |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
677 let a = matchstr(v:exception,'^[^ ]*') |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
678 endtry |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
679 call assert_match('E492:', a) |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
680 endfunc |
14317
1bc96dbb5498
patch 8.1.0174: after paging up and down fold line is wrong
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
681 |
1bc96dbb5498
patch 8.1.0174: after paging up and down fold line is wrong
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
682 func Test_fold_last_line_with_pagedown() |
1bc96dbb5498
patch 8.1.0174: after paging up and down fold line is wrong
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
683 enew! |
1bc96dbb5498
patch 8.1.0174: after paging up and down fold line is wrong
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
684 set fdm=manual |
1bc96dbb5498
patch 8.1.0174: after paging up and down fold line is wrong
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
685 |
1bc96dbb5498
patch 8.1.0174: after paging up and down fold line is wrong
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
686 let expect = '+-- 11 lines: 9---' |
1bc96dbb5498
patch 8.1.0174: after paging up and down fold line is wrong
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
687 let content = range(1,19) |
1bc96dbb5498
patch 8.1.0174: after paging up and down fold line is wrong
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
688 call append(0, content) |
1bc96dbb5498
patch 8.1.0174: after paging up and down fold line is wrong
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
689 normal dd9G |
1bc96dbb5498
patch 8.1.0174: after paging up and down fold line is wrong
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
690 normal zfG |
1bc96dbb5498
patch 8.1.0174: after paging up and down fold line is wrong
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
691 normal zt |
1bc96dbb5498
patch 8.1.0174: after paging up and down fold line is wrong
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
692 call assert_equal('9', getline(foldclosed('.'))) |
1bc96dbb5498
patch 8.1.0174: after paging up and down fold line is wrong
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
693 call assert_equal('19', getline(foldclosedend('.'))) |
1bc96dbb5498
patch 8.1.0174: after paging up and down fold line is wrong
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
694 call assert_equal(expect, ScreenLines(1, len(expect))[0]) |
1bc96dbb5498
patch 8.1.0174: after paging up and down fold line is wrong
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
695 call feedkeys("\<C-F>", 'xt') |
1bc96dbb5498
patch 8.1.0174: after paging up and down fold line is wrong
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
696 call assert_equal(expect, ScreenLines(1, len(expect))[0]) |
1bc96dbb5498
patch 8.1.0174: after paging up and down fold line is wrong
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
697 call feedkeys("\<C-F>", 'xt') |
1bc96dbb5498
patch 8.1.0174: after paging up and down fold line is wrong
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
698 call assert_equal(expect, ScreenLines(1, len(expect))[0]) |
1bc96dbb5498
patch 8.1.0174: after paging up and down fold line is wrong
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
699 call feedkeys("\<C-B>\<C-F>\<C-F>", 'xt') |
1bc96dbb5498
patch 8.1.0174: after paging up and down fold line is wrong
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
700 call assert_equal(expect, ScreenLines(1, len(expect))[0]) |
1bc96dbb5498
patch 8.1.0174: after paging up and down fold line is wrong
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
701 |
1bc96dbb5498
patch 8.1.0174: after paging up and down fold line is wrong
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
702 set fdm& |
1bc96dbb5498
patch 8.1.0174: after paging up and down fold line is wrong
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
703 enew! |
1bc96dbb5498
patch 8.1.0174: after paging up and down fold line is wrong
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
704 endfunc |
14875
081f30c50300
patch 8.1.0449: when 'rnu' is set folded lines are not displayed correctly
Christian Brabandt <cb@256bit.org>
parents:
14317
diff
changeset
|
705 |
081f30c50300
patch 8.1.0449: when 'rnu' is set folded lines are not displayed correctly
Christian Brabandt <cb@256bit.org>
parents:
14317
diff
changeset
|
706 func Test_folds_with_rnu() |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
707 CheckScreendump |
14875
081f30c50300
patch 8.1.0449: when 'rnu' is set folded lines are not displayed correctly
Christian Brabandt <cb@256bit.org>
parents:
14317
diff
changeset
|
708 |
081f30c50300
patch 8.1.0449: when 'rnu' is set folded lines are not displayed correctly
Christian Brabandt <cb@256bit.org>
parents:
14317
diff
changeset
|
709 call writefile([ |
081f30c50300
patch 8.1.0449: when 'rnu' is set folded lines are not displayed correctly
Christian Brabandt <cb@256bit.org>
parents:
14317
diff
changeset
|
710 \ 'set fdm=marker rnu foldcolumn=2', |
081f30c50300
patch 8.1.0449: when 'rnu' is set folded lines are not displayed correctly
Christian Brabandt <cb@256bit.org>
parents:
14317
diff
changeset
|
711 \ 'call setline(1, ["{{{1", "nline 1", "{{{1", "line 2"])', |
081f30c50300
patch 8.1.0449: when 'rnu' is set folded lines are not displayed correctly
Christian Brabandt <cb@256bit.org>
parents:
14317
diff
changeset
|
712 \ ], 'Xtest_folds_with_rnu') |
081f30c50300
patch 8.1.0449: when 'rnu' is set folded lines are not displayed correctly
Christian Brabandt <cb@256bit.org>
parents:
14317
diff
changeset
|
713 let buf = RunVimInTerminal('-S Xtest_folds_with_rnu', {}) |
081f30c50300
patch 8.1.0449: when 'rnu' is set folded lines are not displayed correctly
Christian Brabandt <cb@256bit.org>
parents:
14317
diff
changeset
|
714 |
081f30c50300
patch 8.1.0449: when 'rnu' is set folded lines are not displayed correctly
Christian Brabandt <cb@256bit.org>
parents:
14317
diff
changeset
|
715 call VerifyScreenDump(buf, 'Test_folds_with_rnu_01', {}) |
081f30c50300
patch 8.1.0449: when 'rnu' is set folded lines are not displayed correctly
Christian Brabandt <cb@256bit.org>
parents:
14317
diff
changeset
|
716 call term_sendkeys(buf, "j") |
081f30c50300
patch 8.1.0449: when 'rnu' is set folded lines are not displayed correctly
Christian Brabandt <cb@256bit.org>
parents:
14317
diff
changeset
|
717 call VerifyScreenDump(buf, 'Test_folds_with_rnu_02', {}) |
081f30c50300
patch 8.1.0449: when 'rnu' is set folded lines are not displayed correctly
Christian Brabandt <cb@256bit.org>
parents:
14317
diff
changeset
|
718 |
081f30c50300
patch 8.1.0449: when 'rnu' is set folded lines are not displayed correctly
Christian Brabandt <cb@256bit.org>
parents:
14317
diff
changeset
|
719 " clean up |
081f30c50300
patch 8.1.0449: when 'rnu' is set folded lines are not displayed correctly
Christian Brabandt <cb@256bit.org>
parents:
14317
diff
changeset
|
720 call StopVimInTerminal(buf) |
081f30c50300
patch 8.1.0449: when 'rnu' is set folded lines are not displayed correctly
Christian Brabandt <cb@256bit.org>
parents:
14317
diff
changeset
|
721 call delete('Xtest_folds_with_rnu') |
081f30c50300
patch 8.1.0449: when 'rnu' is set folded lines are not displayed correctly
Christian Brabandt <cb@256bit.org>
parents:
14317
diff
changeset
|
722 endfunc |
15119
6e9f37bf987b
patch 8.1.0570: 'commentstring' not used when adding fold marker
Bram Moolenaar <Bram@vim.org>
parents:
14875
diff
changeset
|
723 |
6e9f37bf987b
patch 8.1.0570: 'commentstring' not used when adding fold marker
Bram Moolenaar <Bram@vim.org>
parents:
14875
diff
changeset
|
724 func Test_folds_marker_in_comment2() |
6e9f37bf987b
patch 8.1.0570: 'commentstring' not used when adding fold marker
Bram Moolenaar <Bram@vim.org>
parents:
14875
diff
changeset
|
725 new |
6e9f37bf987b
patch 8.1.0570: 'commentstring' not used when adding fold marker
Bram Moolenaar <Bram@vim.org>
parents:
14875
diff
changeset
|
726 call setline(1, ['Lorem ipsum dolor sit', 'Lorem ipsum dolor sit', 'Lorem ipsum dolor sit']) |
6e9f37bf987b
patch 8.1.0570: 'commentstring' not used when adding fold marker
Bram Moolenaar <Bram@vim.org>
parents:
14875
diff
changeset
|
727 setl fen fdm=marker |
6e9f37bf987b
patch 8.1.0570: 'commentstring' not used when adding fold marker
Bram Moolenaar <Bram@vim.org>
parents:
14875
diff
changeset
|
728 setl commentstring=<!--%s--> |
6e9f37bf987b
patch 8.1.0570: 'commentstring' not used when adding fold marker
Bram Moolenaar <Bram@vim.org>
parents:
14875
diff
changeset
|
729 setl comments=s:<!--,m:\ \ \ \ ,e:--> |
6e9f37bf987b
patch 8.1.0570: 'commentstring' not used when adding fold marker
Bram Moolenaar <Bram@vim.org>
parents:
14875
diff
changeset
|
730 norm! zf2j |
6e9f37bf987b
patch 8.1.0570: 'commentstring' not used when adding fold marker
Bram Moolenaar <Bram@vim.org>
parents:
14875
diff
changeset
|
731 setl nofen |
6e9f37bf987b
patch 8.1.0570: 'commentstring' not used when adding fold marker
Bram Moolenaar <Bram@vim.org>
parents:
14875
diff
changeset
|
732 :1y |
6e9f37bf987b
patch 8.1.0570: 'commentstring' not used when adding fold marker
Bram Moolenaar <Bram@vim.org>
parents:
14875
diff
changeset
|
733 call assert_equal(['Lorem ipsum dolor sit<!--{{{-->'], getreg(0,1,1)) |
6e9f37bf987b
patch 8.1.0570: 'commentstring' not used when adding fold marker
Bram Moolenaar <Bram@vim.org>
parents:
14875
diff
changeset
|
734 :+2y |
6e9f37bf987b
patch 8.1.0570: 'commentstring' not used when adding fold marker
Bram Moolenaar <Bram@vim.org>
parents:
14875
diff
changeset
|
735 call assert_equal(['Lorem ipsum dolor sit<!--}}}-->'], getreg(0,1,1)) |
6e9f37bf987b
patch 8.1.0570: 'commentstring' not used when adding fold marker
Bram Moolenaar <Bram@vim.org>
parents:
14875
diff
changeset
|
736 |
6e9f37bf987b
patch 8.1.0570: 'commentstring' not used when adding fold marker
Bram Moolenaar <Bram@vim.org>
parents:
14875
diff
changeset
|
737 set foldmethod& |
6e9f37bf987b
patch 8.1.0570: 'commentstring' not used when adding fold marker
Bram Moolenaar <Bram@vim.org>
parents:
14875
diff
changeset
|
738 bwipe! |
6e9f37bf987b
patch 8.1.0570: 'commentstring' not used when adding fold marker
Bram Moolenaar <Bram@vim.org>
parents:
14875
diff
changeset
|
739 endfunc |
17787
92e0996e1cb8
patch 8.1.1890: ml_get error when deleting fold marker
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
740 |
92e0996e1cb8
patch 8.1.1890: ml_get error when deleting fold marker
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
741 func Test_fold_delete_with_marker() |
92e0996e1cb8
patch 8.1.1890: ml_get error when deleting fold marker
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
742 new |
92e0996e1cb8
patch 8.1.1890: ml_get error when deleting fold marker
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
743 call setline(1, ['func Func() {{{1', 'endfunc']) |
92e0996e1cb8
patch 8.1.1890: ml_get error when deleting fold marker
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
744 1,2yank |
92e0996e1cb8
patch 8.1.1890: ml_get error when deleting fold marker
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
745 new |
92e0996e1cb8
patch 8.1.1890: ml_get error when deleting fold marker
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
746 set fdm=marker |
92e0996e1cb8
patch 8.1.1890: ml_get error when deleting fold marker
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
747 call setline(1, 'x') |
92e0996e1cb8
patch 8.1.1890: ml_get error when deleting fold marker
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
748 normal! Vp |
92e0996e1cb8
patch 8.1.1890: ml_get error when deleting fold marker
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
749 normal! zd |
92e0996e1cb8
patch 8.1.1890: ml_get error when deleting fold marker
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
750 call assert_equal(['func Func() ', 'endfunc'], getline(1, '$')) |
92e0996e1cb8
patch 8.1.1890: ml_get error when deleting fold marker
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
751 |
92e0996e1cb8
patch 8.1.1890: ml_get error when deleting fold marker
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
752 set fdm& |
92e0996e1cb8
patch 8.1.1890: ml_get error when deleting fold marker
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
753 bwipe! |
92e0996e1cb8
patch 8.1.1890: ml_get error when deleting fold marker
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
754 bwipe! |
92e0996e1cb8
patch 8.1.1890: ml_get error when deleting fold marker
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
755 endfunc |
18114
90b0af9ba4ff
patch 8.1.2052: using "x" before a closed fold may delete that fold
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
756 |
90b0af9ba4ff
patch 8.1.2052: using "x" before a closed fold may delete that fold
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
757 func Test_fold_delete_with_marker_and_whichwrap() |
90b0af9ba4ff
patch 8.1.2052: using "x" before a closed fold may delete that fold
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
758 new |
90b0af9ba4ff
patch 8.1.2052: using "x" before a closed fold may delete that fold
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
759 let content1 = [''] |
90b0af9ba4ff
patch 8.1.2052: using "x" before a closed fold may delete that fold
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
760 let content2 = ['folded line 1 "{{{1', ' test', ' test2', ' test3', '', 'folded line 2 "{{{1', ' test', ' test2', ' test3'] |
90b0af9ba4ff
patch 8.1.2052: using "x" before a closed fold may delete that fold
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
761 call setline(1, content1 + content2) |
90b0af9ba4ff
patch 8.1.2052: using "x" before a closed fold may delete that fold
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
762 set fdm=marker ww+=l |
90b0af9ba4ff
patch 8.1.2052: using "x" before a closed fold may delete that fold
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
763 normal! x |
90b0af9ba4ff
patch 8.1.2052: using "x" before a closed fold may delete that fold
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
764 call assert_equal(content2, getline(1, '$')) |
90b0af9ba4ff
patch 8.1.2052: using "x" before a closed fold may delete that fold
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
765 set fdm& ww& |
90b0af9ba4ff
patch 8.1.2052: using "x" before a closed fold may delete that fold
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
766 bwipe! |
90b0af9ba4ff
patch 8.1.2052: using "x" before a closed fold may delete that fold
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
767 endfunc |
18882
f9e41ffd3539
patch 8.2.0002: "dj" only deletes first line of closed fold
Bram Moolenaar <Bram@vim.org>
parents:
18114
diff
changeset
|
768 |
f9e41ffd3539
patch 8.2.0002: "dj" only deletes first line of closed fold
Bram Moolenaar <Bram@vim.org>
parents:
18114
diff
changeset
|
769 func Test_fold_delete_first_line() |
f9e41ffd3539
patch 8.2.0002: "dj" only deletes first line of closed fold
Bram Moolenaar <Bram@vim.org>
parents:
18114
diff
changeset
|
770 new |
f9e41ffd3539
patch 8.2.0002: "dj" only deletes first line of closed fold
Bram Moolenaar <Bram@vim.org>
parents:
18114
diff
changeset
|
771 call setline(1, [ |
f9e41ffd3539
patch 8.2.0002: "dj" only deletes first line of closed fold
Bram Moolenaar <Bram@vim.org>
parents:
18114
diff
changeset
|
772 \ '" x {{{1', |
f9e41ffd3539
patch 8.2.0002: "dj" only deletes first line of closed fold
Bram Moolenaar <Bram@vim.org>
parents:
18114
diff
changeset
|
773 \ '" a', |
f9e41ffd3539
patch 8.2.0002: "dj" only deletes first line of closed fold
Bram Moolenaar <Bram@vim.org>
parents:
18114
diff
changeset
|
774 \ '" aa', |
f9e41ffd3539
patch 8.2.0002: "dj" only deletes first line of closed fold
Bram Moolenaar <Bram@vim.org>
parents:
18114
diff
changeset
|
775 \ '" x {{{1', |
f9e41ffd3539
patch 8.2.0002: "dj" only deletes first line of closed fold
Bram Moolenaar <Bram@vim.org>
parents:
18114
diff
changeset
|
776 \ '" b', |
f9e41ffd3539
patch 8.2.0002: "dj" only deletes first line of closed fold
Bram Moolenaar <Bram@vim.org>
parents:
18114
diff
changeset
|
777 \ '" bb', |
f9e41ffd3539
patch 8.2.0002: "dj" only deletes first line of closed fold
Bram Moolenaar <Bram@vim.org>
parents:
18114
diff
changeset
|
778 \ '" x {{{1', |
f9e41ffd3539
patch 8.2.0002: "dj" only deletes first line of closed fold
Bram Moolenaar <Bram@vim.org>
parents:
18114
diff
changeset
|
779 \ '" c', |
f9e41ffd3539
patch 8.2.0002: "dj" only deletes first line of closed fold
Bram Moolenaar <Bram@vim.org>
parents:
18114
diff
changeset
|
780 \ '" cc', |
f9e41ffd3539
patch 8.2.0002: "dj" only deletes first line of closed fold
Bram Moolenaar <Bram@vim.org>
parents:
18114
diff
changeset
|
781 \ ]) |
f9e41ffd3539
patch 8.2.0002: "dj" only deletes first line of closed fold
Bram Moolenaar <Bram@vim.org>
parents:
18114
diff
changeset
|
782 set foldmethod=marker |
f9e41ffd3539
patch 8.2.0002: "dj" only deletes first line of closed fold
Bram Moolenaar <Bram@vim.org>
parents:
18114
diff
changeset
|
783 1 |
f9e41ffd3539
patch 8.2.0002: "dj" only deletes first line of closed fold
Bram Moolenaar <Bram@vim.org>
parents:
18114
diff
changeset
|
784 normal dj |
f9e41ffd3539
patch 8.2.0002: "dj" only deletes first line of closed fold
Bram Moolenaar <Bram@vim.org>
parents:
18114
diff
changeset
|
785 call assert_equal([ |
f9e41ffd3539
patch 8.2.0002: "dj" only deletes first line of closed fold
Bram Moolenaar <Bram@vim.org>
parents:
18114
diff
changeset
|
786 \ '" x {{{1', |
f9e41ffd3539
patch 8.2.0002: "dj" only deletes first line of closed fold
Bram Moolenaar <Bram@vim.org>
parents:
18114
diff
changeset
|
787 \ '" c', |
f9e41ffd3539
patch 8.2.0002: "dj" only deletes first line of closed fold
Bram Moolenaar <Bram@vim.org>
parents:
18114
diff
changeset
|
788 \ '" cc', |
f9e41ffd3539
patch 8.2.0002: "dj" only deletes first line of closed fold
Bram Moolenaar <Bram@vim.org>
parents:
18114
diff
changeset
|
789 \ ], getline(1,'$')) |
f9e41ffd3539
patch 8.2.0002: "dj" only deletes first line of closed fold
Bram Moolenaar <Bram@vim.org>
parents:
18114
diff
changeset
|
790 bwipe! |
f9e41ffd3539
patch 8.2.0002: "dj" only deletes first line of closed fold
Bram Moolenaar <Bram@vim.org>
parents:
18114
diff
changeset
|
791 set foldmethod& |
f9e41ffd3539
patch 8.2.0002: "dj" only deletes first line of closed fold
Bram Moolenaar <Bram@vim.org>
parents:
18114
diff
changeset
|
792 endfunc |
20156
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
18882
diff
changeset
|
793 |
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
18882
diff
changeset
|
794 " Test for errors in 'foldexpr' |
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
18882
diff
changeset
|
795 func Test_fold_expr_error() |
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
18882
diff
changeset
|
796 new |
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
18882
diff
changeset
|
797 call setline(1, ['one', 'two', 'three']) |
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
18882
diff
changeset
|
798 |
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
18882
diff
changeset
|
799 " Return a list from the expression |
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
18882
diff
changeset
|
800 set foldexpr=[] |
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
18882
diff
changeset
|
801 set foldmethod=expr |
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
18882
diff
changeset
|
802 for i in range(3) |
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
18882
diff
changeset
|
803 call assert_equal(0, foldlevel(i)) |
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
18882
diff
changeset
|
804 endfor |
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
18882
diff
changeset
|
805 |
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
18882
diff
changeset
|
806 " expression error |
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
18882
diff
changeset
|
807 set foldexpr=[{] |
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
18882
diff
changeset
|
808 set foldmethod=expr |
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
18882
diff
changeset
|
809 for i in range(3) |
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
18882
diff
changeset
|
810 call assert_equal(0, foldlevel(i)) |
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
18882
diff
changeset
|
811 endfor |
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
18882
diff
changeset
|
812 |
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
18882
diff
changeset
|
813 set foldmethod& foldexpr& |
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
18882
diff
changeset
|
814 close! |
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
18882
diff
changeset
|
815 endfunc |
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
18882
diff
changeset
|
816 |
22306
86696c617f70
patch 8.2.1702: crash when using undo after deleting folded lines
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
817 func Test_undo_fold_deletion() |
86696c617f70
patch 8.2.1702: crash when using undo after deleting folded lines
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
818 new |
86696c617f70
patch 8.2.1702: crash when using undo after deleting folded lines
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
819 set fdm=marker |
86696c617f70
patch 8.2.1702: crash when using undo after deleting folded lines
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
820 let lines =<< trim END |
86696c617f70
patch 8.2.1702: crash when using undo after deleting folded lines
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
821 " {{{ |
86696c617f70
patch 8.2.1702: crash when using undo after deleting folded lines
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
822 " }}}1 |
86696c617f70
patch 8.2.1702: crash when using undo after deleting folded lines
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
823 " {{{ |
86696c617f70
patch 8.2.1702: crash when using undo after deleting folded lines
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
824 END |
86696c617f70
patch 8.2.1702: crash when using undo after deleting folded lines
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
825 call setline(1, lines) |
86696c617f70
patch 8.2.1702: crash when using undo after deleting folded lines
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
826 3d |
86696c617f70
patch 8.2.1702: crash when using undo after deleting folded lines
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
827 g/"/d |
86696c617f70
patch 8.2.1702: crash when using undo after deleting folded lines
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
828 undo |
86696c617f70
patch 8.2.1702: crash when using undo after deleting folded lines
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
829 redo |
86696c617f70
patch 8.2.1702: crash when using undo after deleting folded lines
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
830 eval getline(1, '$')->assert_equal(['']) |
86696c617f70
patch 8.2.1702: crash when using undo after deleting folded lines
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
831 |
86696c617f70
patch 8.2.1702: crash when using undo after deleting folded lines
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
832 set fdm&vim |
86696c617f70
patch 8.2.1702: crash when using undo after deleting folded lines
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
833 bwipe! |
86696c617f70
patch 8.2.1702: crash when using undo after deleting folded lines
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
834 endfunc |
86696c617f70
patch 8.2.1702: crash when using undo after deleting folded lines
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
835 |
22798
3c72820f88b2
patch 8.2.1947: crash when using "zj" without folds
Bram Moolenaar <Bram@vim.org>
parents:
22306
diff
changeset
|
836 " this was crashing |
3c72820f88b2
patch 8.2.1947: crash when using "zj" without folds
Bram Moolenaar <Bram@vim.org>
parents:
22306
diff
changeset
|
837 func Test_move_no_folds() |
3c72820f88b2
patch 8.2.1947: crash when using "zj" without folds
Bram Moolenaar <Bram@vim.org>
parents:
22306
diff
changeset
|
838 new |
3c72820f88b2
patch 8.2.1947: crash when using "zj" without folds
Bram Moolenaar <Bram@vim.org>
parents:
22306
diff
changeset
|
839 fold |
3c72820f88b2
patch 8.2.1947: crash when using "zj" without folds
Bram Moolenaar <Bram@vim.org>
parents:
22306
diff
changeset
|
840 setlocal fdm=expr |
3c72820f88b2
patch 8.2.1947: crash when using "zj" without folds
Bram Moolenaar <Bram@vim.org>
parents:
22306
diff
changeset
|
841 normal zj |
3c72820f88b2
patch 8.2.1947: crash when using "zj" without folds
Bram Moolenaar <Bram@vim.org>
parents:
22306
diff
changeset
|
842 bwipe! |
3c72820f88b2
patch 8.2.1947: crash when using "zj" without folds
Bram Moolenaar <Bram@vim.org>
parents:
22306
diff
changeset
|
843 endfunc |
3c72820f88b2
patch 8.2.1947: crash when using "zj" without folds
Bram Moolenaar <Bram@vim.org>
parents:
22306
diff
changeset
|
844 |
22850
b05cfda397dc
patch 8.2.1972: crash when recreating nested fold
Bram Moolenaar <Bram@vim.org>
parents:
22798
diff
changeset
|
845 " this was crashing |
b05cfda397dc
patch 8.2.1972: crash when recreating nested fold
Bram Moolenaar <Bram@vim.org>
parents:
22798
diff
changeset
|
846 func Test_fold_create_delete_create() |
b05cfda397dc
patch 8.2.1972: crash when recreating nested fold
Bram Moolenaar <Bram@vim.org>
parents:
22798
diff
changeset
|
847 new |
b05cfda397dc
patch 8.2.1972: crash when recreating nested fold
Bram Moolenaar <Bram@vim.org>
parents:
22798
diff
changeset
|
848 fold |
b05cfda397dc
patch 8.2.1972: crash when recreating nested fold
Bram Moolenaar <Bram@vim.org>
parents:
22798
diff
changeset
|
849 fold |
b05cfda397dc
patch 8.2.1972: crash when recreating nested fold
Bram Moolenaar <Bram@vim.org>
parents:
22798
diff
changeset
|
850 normal zd |
b05cfda397dc
patch 8.2.1972: crash when recreating nested fold
Bram Moolenaar <Bram@vim.org>
parents:
22798
diff
changeset
|
851 fold |
b05cfda397dc
patch 8.2.1972: crash when recreating nested fold
Bram Moolenaar <Bram@vim.org>
parents:
22798
diff
changeset
|
852 bwipe! |
b05cfda397dc
patch 8.2.1972: crash when recreating nested fold
Bram Moolenaar <Bram@vim.org>
parents:
22798
diff
changeset
|
853 endfunc |
b05cfda397dc
patch 8.2.1972: crash when recreating nested fold
Bram Moolenaar <Bram@vim.org>
parents:
22798
diff
changeset
|
854 |
20156
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
18882
diff
changeset
|
855 " vim: shiftwidth=2 sts=2 expandtab |