1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
" Test for folding
function! Test_address_fold()
new
call setline(1, ['int FuncName() {/*{{{*/', 1, 2, 3, 4, 5, '}/*}}}*/',
\ 'after fold 1', 'after fold 2', 'after fold 3'])
setl fen fdm=marker
" The next ccommands should all copy the same part of the buffer,
" regardless of the adressing type, since the part to be copied
" is folded away
:1y
call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/'], getreg(0,1,1))
:.y
call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/'], getreg(0,1,1))
:.+y
call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/'], getreg(0,1,1))
:.,.y
call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/'], getreg(0,1,1))
:sil .1,.y
call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/'], getreg(0,1,1))
" use silent to make E493 go away
:sil .+,.y
call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/'], getreg(0,1,1))
:,y
call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/'], getreg(0,1,1))
:,+y
call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/','after fold 1'], getreg(0,1,1))
" using .+3 as second address should copy the whole folded line + the next 3
" lines
:.,+3y
call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/',
\ 'after fold 1', 'after fold 2', 'after fold 3'], getreg(0,1,1))
:sil .,-2y
call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3', '4', '5', '}/*}}}*/'], getreg(0,1,1))
" now test again with folding disabled
set nofoldenable
:1y
call assert_equal(['int FuncName() {/*{{{*/'], getreg(0,1,1))
:.y
call assert_equal(['int FuncName() {/*{{{*/'], getreg(0,1,1))
:.+y
call assert_equal(['1'], getreg(0,1,1))
:.,.y
call assert_equal(['int FuncName() {/*{{{*/'], getreg(0,1,1))
" use silent to make E493 go away
:sil .1,.y
call assert_equal(['int FuncName() {/*{{{*/', '1'], getreg(0,1,1))
" use silent to make E493 go away
:sil .+,.y
call assert_equal(['int FuncName() {/*{{{*/', '1'], getreg(0,1,1))
:,y
call assert_equal(['int FuncName() {/*{{{*/'], getreg(0,1,1))
:,+y
call assert_equal(['int FuncName() {/*{{{*/', '1'], getreg(0,1,1))
" using .+3 as second address should copy the whole folded line + the next 3
" lines
:.,+3y
call assert_equal(['int FuncName() {/*{{{*/', '1', '2', '3'], getreg(0,1,1))
:7
:sil .,-2y
call assert_equal(['4', '5', '}/*}}}*/'], getreg(0,1,1))
quit!
endfunction
|