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