annotate src/testdir/test_fold.vim @ 10484:c7de1536780a v8.0.0135

commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jan 2 14:27:34 2017 +0100 patch 8.0.0135 Problem: An address relative to the current line, ":.,+3y", does not work properly on a closed fold. (Efraim Yawitz) Solution: Correct for including the closed fold. (Christian Brabandt)
author Christian Brabandt <cb@256bit.org>
date Mon, 02 Jan 2017 14:30:04 +0100
parents
children 99896ee0cac5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 function! Test_address_fold()
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 new
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 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
6 \ '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
7 setl fen fdm=marker
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 " The next ccommands should all copy the same part of the buffer,
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 " regardless of the adressing type, since the part to be copied
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 " is folded away
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 :1y
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 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
13 :.y
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 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
15 :.+y
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 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
17 :.,.y
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 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
19 :sil .1,.y
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 " use silent to make E493 go away
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 :sil .+,.y
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 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
24 :,y
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 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
26 :,+y
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 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
28 " 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
29 " lines
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 :.,+3y
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', '}/*}}}*/',
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 \ '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
33 :sil .,-2y
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 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
35
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 " now test again with folding disabled
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 set nofoldenable
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 :1y
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 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
40 :.y
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 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
42 :.+y
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 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
44 :.,.y
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 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
46 " use silent to make E493 go away
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 :sil .1,.y
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 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
49 " use silent to make E493 go away
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 :sil .+,.y
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 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
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 :,+y
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 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
56 " 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
57 " lines
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 :.,+3y
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 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
60 :7
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 :sil .,-2y
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 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
63
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 quit!
c7de1536780a commit https://github.com/vim/vim/commit/ded2782783f352201ac0b05c6dbe4831adb4a58b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 endfunction