Mercurial > vim
annotate src/testdir/test_visual.vim @ 35140:9ba95f736abb default tip
Added tag v9.1.0399 for changeset 617f9087f97c05289903b9e88f487ef74d8869fc
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 08 May 2024 22:30:04 +0200 |
parents | 617f9087f97c |
children |
rev | line source |
---|---|
18825
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1 " Tests for various Visual modes. |
11091
ae45d497868f
patch 8.0.0433: beeps when running tests
Christian Brabandt <cb@256bit.org>
parents:
10900
diff
changeset
|
2 |
22502
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
3 source shared.vim |
25070
f397a21b3e4c
patch 8.2.3072: "zy" does not work well when "virtualedit' is "block"
Bram Moolenaar <Bram@vim.org>
parents:
24866
diff
changeset
|
4 source check.vim |
25102
b7062becbfb5
patch 8.2.3088: with 'virtualedit' set to "block" Visual highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents:
25072
diff
changeset
|
5 source screendump.vim |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
6 import './vim9.vim' as v9 |
22502
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
7 |
8401
98955c2ffd9f
commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 func Test_block_shift_multibyte() |
10494
1e700d72561d
commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents:
9618
diff
changeset
|
9 " Uses double-wide character. |
8401
98955c2ffd9f
commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 split |
98955c2ffd9f
commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 call setline(1, ['xヹxxx', 'ヹxxx']) |
98955c2ffd9f
commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 exe "normal 1G0l\<C-V>jl>" |
98955c2ffd9f
commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 call assert_equal('x ヹxxx', getline(1)) |
98955c2ffd9f
commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 call assert_equal(' ヹxxx', getline(2)) |
98955c2ffd9f
commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 q! |
98955c2ffd9f
commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 endfunc |
10494
1e700d72561d
commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents:
9618
diff
changeset
|
17 |
11997
66b677c77467
patch 8.0.0879: crash when shifting with huge number
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
18 func Test_block_shift_overflow() |
66b677c77467
patch 8.0.0879: crash when shifting with huge number
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
19 " This used to cause a multiplication overflow followed by a crash. |
66b677c77467
patch 8.0.0879: crash when shifting with huge number
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
20 new |
66b677c77467
patch 8.0.0879: crash when shifting with huge number
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
21 normal ii |
66b677c77467
patch 8.0.0879: crash when shifting with huge number
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
22 exe "normal \<C-V>876543210>" |
66b677c77467
patch 8.0.0879: crash when shifting with huge number
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
23 q! |
66b677c77467
patch 8.0.0879: crash when shifting with huge number
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
24 endfunc |
66b677c77467
patch 8.0.0879: crash when shifting with huge number
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
25 |
10494
1e700d72561d
commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents:
9618
diff
changeset
|
26 func Test_dotregister_paste() |
1e700d72561d
commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents:
9618
diff
changeset
|
27 new |
1e700d72561d
commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents:
9618
diff
changeset
|
28 exe "norm! ihello world\<esc>" |
1e700d72561d
commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents:
9618
diff
changeset
|
29 norm! 0ve".p |
1e700d72561d
commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents:
9618
diff
changeset
|
30 call assert_equal('hello world world', getline(1)) |
1e700d72561d
commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents:
9618
diff
changeset
|
31 q! |
1e700d72561d
commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents:
9618
diff
changeset
|
32 endfunc |
10803
065da86ca6d2
patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents:
10494
diff
changeset
|
33 |
065da86ca6d2
patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents:
10494
diff
changeset
|
34 func Test_Visual_ctrl_o() |
065da86ca6d2
patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents:
10494
diff
changeset
|
35 new |
065da86ca6d2
patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents:
10494
diff
changeset
|
36 call setline(1, ['one', 'two', 'three']) |
065da86ca6d2
patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents:
10494
diff
changeset
|
37 call cursor(1,2) |
065da86ca6d2
patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents:
10494
diff
changeset
|
38 set noshowmode |
065da86ca6d2
patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents:
10494
diff
changeset
|
39 set tw=0 |
065da86ca6d2
patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents:
10494
diff
changeset
|
40 call feedkeys("\<c-v>jjlIa\<c-\>\<c-o>:set tw=88\<cr>\<esc>", 'tx') |
065da86ca6d2
patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents:
10494
diff
changeset
|
41 call assert_equal(['oane', 'tawo', 'tahree'], getline(1, 3)) |
065da86ca6d2
patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents:
10494
diff
changeset
|
42 call assert_equal(88, &tw) |
065da86ca6d2
patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents:
10494
diff
changeset
|
43 set tw& |
065da86ca6d2
patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents:
10494
diff
changeset
|
44 bw! |
065da86ca6d2
patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents:
10494
diff
changeset
|
45 endfu |
10881
8f6df2f6d2fc
patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents:
10803
diff
changeset
|
46 |
8f6df2f6d2fc
patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents:
10803
diff
changeset
|
47 func Test_Visual_vapo() |
8f6df2f6d2fc
patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents:
10803
diff
changeset
|
48 new |
8f6df2f6d2fc
patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents:
10803
diff
changeset
|
49 normal oxx |
8f6df2f6d2fc
patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents:
10803
diff
changeset
|
50 normal vapo |
8f6df2f6d2fc
patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents:
10803
diff
changeset
|
51 bwipe! |
8f6df2f6d2fc
patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents:
10803
diff
changeset
|
52 endfunc |
10900
9b4574d95571
patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents:
10881
diff
changeset
|
53 |
9b4574d95571
patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents:
10881
diff
changeset
|
54 func Test_Visual_inner_quote() |
9b4574d95571
patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents:
10881
diff
changeset
|
55 new |
9b4574d95571
patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents:
10881
diff
changeset
|
56 normal oxX |
9b4574d95571
patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents:
10881
diff
changeset
|
57 normal vki' |
9b4574d95571
patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents:
10881
diff
changeset
|
58 bwipe! |
9b4574d95571
patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents:
10881
diff
changeset
|
59 endfunc |
12019
7d7835ab8b37
patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11997
diff
changeset
|
60 |
7d7835ab8b37
patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11997
diff
changeset
|
61 " Test for Visual mode not being reset causing E315 error. |
7d7835ab8b37
patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11997
diff
changeset
|
62 func TriggerTheProblem() |
7d7835ab8b37
patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11997
diff
changeset
|
63 " At this point there is no visual selection because :call reset it. |
7d7835ab8b37
patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11997
diff
changeset
|
64 " Let's restore the selection: |
7d7835ab8b37
patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11997
diff
changeset
|
65 normal gv |
7d7835ab8b37
patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11997
diff
changeset
|
66 '<,'>del _ |
7d7835ab8b37
patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11997
diff
changeset
|
67 try |
7d7835ab8b37
patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11997
diff
changeset
|
68 exe "normal \<Esc>" |
7d7835ab8b37
patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11997
diff
changeset
|
69 catch /^Vim\%((\a\+)\)\=:E315/ |
7d7835ab8b37
patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11997
diff
changeset
|
70 echom 'Snap! E315 error!' |
13402
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
71 let g:msg = 'Snap! E315 error!' |
12019
7d7835ab8b37
patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11997
diff
changeset
|
72 endtry |
7d7835ab8b37
patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11997
diff
changeset
|
73 endfunc |
7d7835ab8b37
patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11997
diff
changeset
|
74 |
7d7835ab8b37
patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11997
diff
changeset
|
75 func Test_visual_mode_reset() |
7d7835ab8b37
patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11997
diff
changeset
|
76 enew |
13402
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
77 let g:msg = "Everything's fine." |
12019
7d7835ab8b37
patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11997
diff
changeset
|
78 enew |
7d7835ab8b37
patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11997
diff
changeset
|
79 setl buftype=nofile |
7d7835ab8b37
patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11997
diff
changeset
|
80 call append(line('$'), 'Delete this line.') |
7d7835ab8b37
patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11997
diff
changeset
|
81 |
7d7835ab8b37
patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11997
diff
changeset
|
82 " NOTE: this has to be done by a call to a function because executing :del |
7d7835ab8b37
patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11997
diff
changeset
|
83 " the ex-way will require the colon operator which resets the visual mode |
7d7835ab8b37
patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11997
diff
changeset
|
84 " thus preventing the problem: |
7d7835ab8b37
patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11997
diff
changeset
|
85 exe "normal! GV:call TriggerTheProblem()\<CR>" |
7d7835ab8b37
patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11997
diff
changeset
|
86 call assert_equal("Everything's fine.", g:msg) |
7d7835ab8b37
patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11997
diff
changeset
|
87 endfunc |
12644
1fad9675d8fd
patch 8.0.1200: tests switch the bell off twice
Christian Brabandt <cb@256bit.org>
parents:
12019
diff
changeset
|
88 |
12686
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
89 " Test for visual block shift and tab characters. |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
90 func Test_block_shift_tab() |
24725
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
91 new |
12686
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
92 call append(0, repeat(['one two three'], 5)) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
93 call cursor(1,1) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
94 exe "normal i\<C-G>u" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
95 exe "normal fe\<C-V>4jR\<Esc>ugvr1" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
96 call assert_equal('on1 two three', getline(1)) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
97 call assert_equal('on1 two three', getline(2)) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
98 call assert_equal('on1 two three', getline(5)) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
99 |
24725
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
100 %d _ |
12686
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
101 call append(0, repeat(['abcdefghijklmnopqrstuvwxyz'], 5)) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
102 call cursor(1,1) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
103 exe "normal \<C-V>4jI \<Esc>j<<11|D" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
104 exe "normal j7|a\<Tab>\<Tab>" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
105 exe "normal j7|a\<Tab>\<Tab> " |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
106 exe "normal j7|a\<Tab> \<Tab>\<Esc>4k13|\<C-V>4j<" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
107 call assert_equal(' abcdefghijklmnopqrstuvwxyz', getline(1)) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
108 call assert_equal('abcdefghij', getline(2)) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
109 call assert_equal(" abc\<Tab> defghijklmnopqrstuvwxyz", getline(3)) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
110 call assert_equal(" abc\<Tab> defghijklmnopqrstuvwxyz", getline(4)) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
111 call assert_equal(" abc\<Tab> defghijklmnopqrstuvwxyz", getline(5)) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
112 |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
113 %s/\s\+//g |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
114 call cursor(1,1) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
115 exe "normal \<C-V>4jI \<Esc>j<<" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
116 exe "normal j7|a\<Tab>\<Tab>" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
117 exe "normal j7|a\<Tab>\<Tab>\<Tab>\<Tab>\<Tab>" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
118 exe "normal j7|a\<Tab> \<Tab>\<Tab>\<Esc>4k13|\<C-V>4j3<" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
119 call assert_equal(' abcdefghijklmnopqrstuvwxyz', getline(1)) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
120 call assert_equal('abcdefghij', getline(2)) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
121 call assert_equal(" abc\<Tab> defghijklmnopqrstuvwxyz", getline(3)) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
122 call assert_equal(" abc\<Tab>\<Tab>defghijklmnopqrstuvwxyz", getline(4)) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
123 call assert_equal(" abc\<Tab> defghijklmnopqrstuvwxyz", getline(5)) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
124 |
24725
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
125 " Test for block shift with space characters at the beginning and with |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
126 " 'noexpandtab' and 'expandtab' |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
127 %d _ |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
128 call setline(1, [" 1", " 2", " 3"]) |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
129 setlocal shiftwidth=2 noexpandtab |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
130 exe "normal gg\<C-V>3j>" |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
131 call assert_equal(["\t1", "\t2", "\t3"], getline(1, '$')) |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
132 %d _ |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
133 call setline(1, [" 1", " 2", " 3"]) |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
134 setlocal shiftwidth=2 expandtab |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
135 exe "normal gg\<C-V>3j>" |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
136 call assert_equal([" 1", " 2", " 3"], getline(1, '$')) |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
137 setlocal shiftwidth& |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
138 |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
139 bw! |
12686
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
140 endfunc |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
141 |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
142 " Tests Blockwise Visual when there are TABs before the text. |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
143 func Test_blockwise_visual() |
24725
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
144 new |
12686
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
145 call append(0, ['123456', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
146 \ '234567', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
147 \ '345678', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
148 \ '', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
149 \ 'test text test tex start here', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
150 \ "\t\tsome text", |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
151 \ "\t\ttest text", |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
152 \ 'test text']) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
153 call cursor(1,1) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
154 exe "normal /start here$\<CR>" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
155 exe 'normal "by$' . "\<C-V>jjlld" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
156 exe "normal /456$\<CR>" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
157 exe "normal \<C-V>jj" . '"bP' |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
158 call assert_equal(['123start here56', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
159 \ '234start here67', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
160 \ '345start here78', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
161 \ '', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
162 \ 'test text test tex rt here', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
163 \ "\t\tsomext", |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
164 \ "\t\ttesext"], getline(1, 7)) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
165 |
24725
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
166 bw! |
12686
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
167 endfunc |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
168 |
13978
81c324144452
patch 8.1.0007: no test for "o" and "O" in Visual block mode
Christian Brabandt <cb@256bit.org>
parents:
13410
diff
changeset
|
169 " Test swapping corners in blockwise visual mode with o and O |
81c324144452
patch 8.1.0007: no test for "o" and "O" in Visual block mode
Christian Brabandt <cb@256bit.org>
parents:
13410
diff
changeset
|
170 func Test_blockwise_visual_o_O() |
24725
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
171 new |
13978
81c324144452
patch 8.1.0007: no test for "o" and "O" in Visual block mode
Christian Brabandt <cb@256bit.org>
parents:
13410
diff
changeset
|
172 |
81c324144452
patch 8.1.0007: no test for "o" and "O" in Visual block mode
Christian Brabandt <cb@256bit.org>
parents:
13410
diff
changeset
|
173 exe "norm! 10i.\<Esc>Y4P3lj\<C-V>4l2jr " |
81c324144452
patch 8.1.0007: no test for "o" and "O" in Visual block mode
Christian Brabandt <cb@256bit.org>
parents:
13410
diff
changeset
|
174 exe "norm! gvO\<Esc>ra" |
81c324144452
patch 8.1.0007: no test for "o" and "O" in Visual block mode
Christian Brabandt <cb@256bit.org>
parents:
13410
diff
changeset
|
175 exe "norm! gvO\<Esc>rb" |
81c324144452
patch 8.1.0007: no test for "o" and "O" in Visual block mode
Christian Brabandt <cb@256bit.org>
parents:
13410
diff
changeset
|
176 exe "norm! gvo\<C-c>rc" |
81c324144452
patch 8.1.0007: no test for "o" and "O" in Visual block mode
Christian Brabandt <cb@256bit.org>
parents:
13410
diff
changeset
|
177 exe "norm! gvO\<C-c>rd" |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
178 set selection=exclusive |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
179 exe "norm! gvOo\<C-c>re" |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
180 call assert_equal('...a be.', getline(4)) |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
181 exe "norm! gvOO\<C-c>rf" |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
182 set selection& |
13978
81c324144452
patch 8.1.0007: no test for "o" and "O" in Visual block mode
Christian Brabandt <cb@256bit.org>
parents:
13410
diff
changeset
|
183 |
81c324144452
patch 8.1.0007: no test for "o" and "O" in Visual block mode
Christian Brabandt <cb@256bit.org>
parents:
13410
diff
changeset
|
184 call assert_equal(['..........', |
81c324144452
patch 8.1.0007: no test for "o" and "O" in Visual block mode
Christian Brabandt <cb@256bit.org>
parents:
13410
diff
changeset
|
185 \ '...c d..', |
81c324144452
patch 8.1.0007: no test for "o" and "O" in Visual block mode
Christian Brabandt <cb@256bit.org>
parents:
13410
diff
changeset
|
186 \ '... ..', |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
187 \ '...a bf.', |
13978
81c324144452
patch 8.1.0007: no test for "o" and "O" in Visual block mode
Christian Brabandt <cb@256bit.org>
parents:
13410
diff
changeset
|
188 \ '..........'], getline(1, '$')) |
81c324144452
patch 8.1.0007: no test for "o" and "O" in Visual block mode
Christian Brabandt <cb@256bit.org>
parents:
13410
diff
changeset
|
189 |
24725
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
190 bw! |
13978
81c324144452
patch 8.1.0007: no test for "o" and "O" in Visual block mode
Christian Brabandt <cb@256bit.org>
parents:
13410
diff
changeset
|
191 endfun |
81c324144452
patch 8.1.0007: no test for "o" and "O" in Visual block mode
Christian Brabandt <cb@256bit.org>
parents:
13410
diff
changeset
|
192 |
12686
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
193 " Test Virtual replace mode. |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
194 func Test_virtual_replace() |
13410
c571356c65bd
patch 8.0.1579: virtual replace test fails in GUI
Christian Brabandt <cb@256bit.org>
parents:
13406
diff
changeset
|
195 if exists('&t_kD') |
c571356c65bd
patch 8.0.1579: virtual replace test fails in GUI
Christian Brabandt <cb@256bit.org>
parents:
13406
diff
changeset
|
196 let save_t_kD = &t_kD |
c571356c65bd
patch 8.0.1579: virtual replace test fails in GUI
Christian Brabandt <cb@256bit.org>
parents:
13406
diff
changeset
|
197 endif |
c571356c65bd
patch 8.0.1579: virtual replace test fails in GUI
Christian Brabandt <cb@256bit.org>
parents:
13406
diff
changeset
|
198 if exists('&t_kb') |
c571356c65bd
patch 8.0.1579: virtual replace test fails in GUI
Christian Brabandt <cb@256bit.org>
parents:
13406
diff
changeset
|
199 let save_t_kb = &t_kb |
c571356c65bd
patch 8.0.1579: virtual replace test fails in GUI
Christian Brabandt <cb@256bit.org>
parents:
13406
diff
changeset
|
200 endif |
12686
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
201 exe "set t_kD=\<C-V>x7f t_kb=\<C-V>x08" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
202 enew! |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
203 exe "normal a\nabcdefghi\njk\tlmn\n opq rst\n\<C-D>uvwxyz" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
204 call cursor(1,1) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
205 set ai bs=2 |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
206 exe "normal gR0\<C-D> 1\nA\nBCDEFGHIJ\n\tKL\nMNO\nPQR" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
207 call assert_equal([' 1', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
208 \ ' A', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
209 \ ' BCDEFGHIJ', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
210 \ ' KL', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
211 \ ' MNO', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
212 \ ' PQR', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
213 \ ], getline(1, 6)) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
214 normal G |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
215 mark a |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
216 exe "normal o0\<C-D>\nabcdefghi\njk\tlmn\n opq\trst\n\<C-D>uvwxyz\n" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
217 exe "normal 'ajgR0\<C-D> 1\nA\nBCDEFGHIJ\n\tKL\nMNO\nPQR" . repeat("\<BS>", 29) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
218 call assert_equal([' 1', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
219 \ 'abcdefghi', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
220 \ 'jk lmn', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
221 \ ' opq rst', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
222 \ 'uvwxyz'], getline(7, 11)) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
223 normal G |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
224 exe "normal iab\tcdefghi\tjkl" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
225 exe "normal 0gRAB......CDEFGHI.J\<Esc>o" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
226 exe "normal iabcdefghijklmnopqrst\<Esc>0gRAB\tIJKLMNO\tQR" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
227 call assert_equal(['AB......CDEFGHI.Jkl', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
228 \ 'AB IJKLMNO QRst'], getline(12, 13)) |
20941
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
229 |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
230 " Test inserting Tab with 'noexpandtab' and 'softabstop' set to 4 |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
231 %d |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
232 call setline(1, 'aaaaaaaaaaaaa') |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
233 set softtabstop=4 |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
234 exe "normal gggR\<Tab>\<Tab>x" |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
235 call assert_equal("\txaaaa", getline(1)) |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
236 set softtabstop& |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
237 |
12686
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
238 enew! |
13406
4e30f3f4cb78
patch 8.0.1577: virtual replace test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
13402
diff
changeset
|
239 set noai bs&vim |
13410
c571356c65bd
patch 8.0.1579: virtual replace test fails in GUI
Christian Brabandt <cb@256bit.org>
parents:
13406
diff
changeset
|
240 if exists('save_t_kD') |
c571356c65bd
patch 8.0.1579: virtual replace test fails in GUI
Christian Brabandt <cb@256bit.org>
parents:
13406
diff
changeset
|
241 let &t_kD = save_t_kD |
c571356c65bd
patch 8.0.1579: virtual replace test fails in GUI
Christian Brabandt <cb@256bit.org>
parents:
13406
diff
changeset
|
242 endif |
c571356c65bd
patch 8.0.1579: virtual replace test fails in GUI
Christian Brabandt <cb@256bit.org>
parents:
13406
diff
changeset
|
243 if exists('save_t_kb') |
c571356c65bd
patch 8.0.1579: virtual replace test fails in GUI
Christian Brabandt <cb@256bit.org>
parents:
13406
diff
changeset
|
244 let &t_kb = save_t_kb |
c571356c65bd
patch 8.0.1579: virtual replace test fails in GUI
Christian Brabandt <cb@256bit.org>
parents:
13406
diff
changeset
|
245 endif |
12686
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
246 endfunc |
13402
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
247 |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
248 " Test Virtual replace mode. |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
249 func Test_virtual_replace2() |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
250 enew! |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
251 set bs=2 |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
252 exe "normal a\nabcdefghi\njk\tlmn\n opq rst\n\<C-D>uvwxyz" |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
253 call cursor(1,1) |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
254 " Test 1: Test that del deletes the newline |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
255 exe "normal gR0\<del> 1\nA\nBCDEFGHIJ\n\tKL\nMNO\nPQR" |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
256 call assert_equal(['0 1', |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
257 \ 'A', |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
258 \ 'BCDEFGHIJ', |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
259 \ ' KL', |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
260 \ 'MNO', |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
261 \ 'PQR', |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
262 \ ], getline(1, 6)) |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
263 " Test 2: |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
264 " a newline is not deleted, if no newline has been added in virtual replace mode |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
265 %d_ |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
266 call setline(1, ['abcd', 'efgh', 'ijkl']) |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
267 call cursor(2,1) |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
268 exe "norm! gR1234\<cr>5\<bs>\<bs>\<bs>" |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
269 call assert_equal(['abcd', |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
270 \ '123h', |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
271 \ 'ijkl'], getline(1, '$')) |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
272 " Test 3: |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
273 " a newline is deleted, if a newline has been inserted before in virtual replace mode |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
274 %d_ |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
275 call setline(1, ['abcd', 'efgh', 'ijkl']) |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
276 call cursor(2,1) |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
277 exe "norm! gR1234\<cr>\<cr>56\<bs>\<bs>\<bs>" |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
278 call assert_equal(['abcd', |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
279 \ '1234', |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
280 \ 'ijkl'], getline(1, '$')) |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
281 " Test 4: |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
282 " delete add a newline, delete it, add it again and check undo |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
283 %d_ |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
284 call setline(1, ['abcd', 'efgh', 'ijkl']) |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
285 call cursor(2,1) |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
286 " break undo sequence explicitly |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
287 let &ul = &ul |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
288 exe "norm! gR1234\<cr>\<bs>\<del>56\<cr>" |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
289 let &ul = &ul |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
290 call assert_equal(['abcd', |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
291 \ '123456', |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
292 \ ''], getline(1, '$')) |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
293 norm! u |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
294 call assert_equal(['abcd', |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
295 \ 'efgh', |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
296 \ 'ijkl'], getline(1, '$')) |
19852
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19738
diff
changeset
|
297 |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19738
diff
changeset
|
298 " Test for truncating spaces in a newly added line using 'autoindent' if |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19738
diff
changeset
|
299 " characters are not added to that line. |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19738
diff
changeset
|
300 %d_ |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19738
diff
changeset
|
301 call setline(1, [' app', ' bee', ' cat']) |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19738
diff
changeset
|
302 setlocal autoindent |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19738
diff
changeset
|
303 exe "normal gg$gRt\n\nr" |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19738
diff
changeset
|
304 call assert_equal([' apt', '', ' rat'], getline(1, '$')) |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19738
diff
changeset
|
305 |
13402
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
306 " clean up |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
307 %d_ |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
308 set bs&vim |
338b15c63e2c
patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
309 endfunc |
15359
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
310 |
15462
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
311 func Test_Visual_word_textobject() |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
312 new |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
313 call setline(1, ['First sentence. Second sentence.']) |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
314 |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
315 " When start and end of visual area are identical, 'aw' or 'iw' select |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
316 " the whole word. |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
317 norm! 1go2fcvawy |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
318 call assert_equal('Second ', @") |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
319 norm! 1go2fcviwy |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
320 call assert_equal('Second', @") |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
321 |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
322 " When start and end of visual area are not identical, 'aw' or 'iw' |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
323 " extend the word in direction of the end of the visual area. |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
324 norm! 1go2fcvlawy |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
325 call assert_equal('cond ', @") |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
326 norm! gv2awy |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
327 call assert_equal('cond sentence.', @") |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
328 |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
329 norm! 1go2fcvliwy |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
330 call assert_equal('cond', @") |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
331 norm! gv2iwy |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
332 call assert_equal('cond sentence', @") |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
333 |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
334 " Extend visual area in opposite direction. |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
335 norm! 1go2fcvhawy |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
336 call assert_equal(' Sec', @") |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
337 norm! gv2awy |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
338 call assert_equal(' sentence. Sec', @") |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
339 |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
340 norm! 1go2fcvhiwy |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
341 call assert_equal('Sec', @") |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
342 norm! gv2iwy |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
343 call assert_equal('. Sec', @") |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
344 |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
345 bwipe! |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
346 endfunc |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
347 |
15359
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
348 func Test_Visual_sentence_textobject() |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
349 new |
15462
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
350 call setline(1, ['First sentence. Second sentence. Third', 'sentence. Fourth sentence']) |
15359
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
351 |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
352 " When start and end of visual area are identical, 'as' or 'is' select |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
353 " the whole sentence. |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
354 norm! 1gofdvasy |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
355 call assert_equal('Second sentence. ', @") |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
356 norm! 1gofdvisy |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
357 call assert_equal('Second sentence.', @") |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
358 |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
359 " When start and end of visual area are not identical, 'as' or 'is' |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
360 " extend the sentence in direction of the end of the visual area. |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
361 norm! 1gofdvlasy |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
362 call assert_equal('d sentence. ', @") |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
363 norm! gvasy |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
364 call assert_equal("d sentence. Third\nsentence. ", @") |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
365 |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
366 norm! 1gofdvlisy |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
367 call assert_equal('d sentence.', @") |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
368 norm! gvisy |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
369 call assert_equal('d sentence. ', @") |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
370 norm! gvisy |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
371 call assert_equal("d sentence. Third\nsentence.", @") |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
372 |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
373 " Extend visual area in opposite direction. |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
374 norm! 1gofdvhasy |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
375 call assert_equal(' Second', @") |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
376 norm! gvasy |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
377 call assert_equal("First sentence. Second", @") |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
378 |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
379 norm! 1gofdvhisy |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
380 call assert_equal('Second', @") |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
381 norm! gvisy |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
382 call assert_equal(' Second', @") |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
383 norm! gvisy |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
384 call assert_equal('First sentence. Second', @") |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
385 |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
386 bwipe! |
bdf5f546eba0
patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents:
13978
diff
changeset
|
387 endfunc |
15462
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
388 |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
389 func Test_Visual_paragraph_textobject() |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
390 new |
22476
b3751f4d3b26
patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21923
diff
changeset
|
391 let lines =<< trim [END] |
b3751f4d3b26
patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21923
diff
changeset
|
392 First line. |
b3751f4d3b26
patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21923
diff
changeset
|
393 |
b3751f4d3b26
patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21923
diff
changeset
|
394 Second line. |
b3751f4d3b26
patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21923
diff
changeset
|
395 Third line. |
b3751f4d3b26
patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21923
diff
changeset
|
396 Fourth line. |
b3751f4d3b26
patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21923
diff
changeset
|
397 Fifth line. |
b3751f4d3b26
patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21923
diff
changeset
|
398 |
b3751f4d3b26
patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21923
diff
changeset
|
399 Sixth line. |
b3751f4d3b26
patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21923
diff
changeset
|
400 [END] |
b3751f4d3b26
patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21923
diff
changeset
|
401 call setline(1, lines) |
15462
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
402 |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
403 " When start and end of visual area are identical, 'ap' or 'ip' select |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
404 " the whole paragraph. |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
405 norm! 4ggvapy |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
406 call assert_equal("Second line.\nThird line.\nFourth line.\nFifth line.\n\n", @") |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
407 norm! 4ggvipy |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
408 call assert_equal("Second line.\nThird line.\nFourth line.\nFifth line.\n", @") |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
409 |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
410 " When start and end of visual area are not identical, 'ap' or 'ip' |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
411 " extend the sentence in direction of the end of the visual area. |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
412 " FIXME: actually, it is not sufficient to have different start and |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
413 " end of visual selection, the start line and end line have to differ, |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
414 " which is not consistent with the documentation. |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
415 norm! 4ggVjapy |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
416 call assert_equal("Third line.\nFourth line.\nFifth line.\n\n", @") |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
417 norm! gvapy |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
418 call assert_equal("Third line.\nFourth line.\nFifth line.\n\nSixth line.\n", @") |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
419 norm! 4ggVjipy |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
420 call assert_equal("Third line.\nFourth line.\nFifth line.\n", @") |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
421 norm! gvipy |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
422 call assert_equal("Third line.\nFourth line.\nFifth line.\n\n", @") |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
423 norm! gvipy |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
424 call assert_equal("Third line.\nFourth line.\nFifth line.\n\nSixth line.\n", @") |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
425 |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
426 " Extend visual area in opposite direction. |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
427 norm! 5ggVkapy |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
428 call assert_equal("\nSecond line.\nThird line.\nFourth line.\n", @") |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
429 norm! gvapy |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
430 call assert_equal("First line.\n\nSecond line.\nThird line.\nFourth line.\n", @") |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
431 norm! 5ggVkipy |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
432 call assert_equal("Second line.\nThird line.\nFourth line.\n", @") |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
433 norma gvipy |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
434 call assert_equal("\nSecond line.\nThird line.\nFourth line.\n", @") |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
435 norm! gvipy |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
436 call assert_equal("First line.\n\nSecond line.\nThird line.\nFourth line.\n", @") |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
437 |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
438 bwipe! |
2c44001e7e13
patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15359
diff
changeset
|
439 endfunc |
15985
e91750e8adb5
patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
440 |
e91750e8adb5
patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
441 func Test_curswant_not_changed() |
e91750e8adb5
patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
442 new |
e91750e8adb5
patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
443 call setline(1, ['one', 'two']) |
e91750e8adb5
patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
444 au InsertLeave * call getcurpos() |
e91750e8adb5
patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
445 call feedkeys("gg0\<C-V>jI123 \<Esc>j", 'xt') |
e91750e8adb5
patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
446 call assert_equal([0, 2, 1, 0, 1], getcurpos()) |
e91750e8adb5
patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
447 |
e91750e8adb5
patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
448 bwipe! |
e91750e8adb5
patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
449 au! InsertLeave |
e91750e8adb5
patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
450 endfunc |
16419
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
15985
diff
changeset
|
451 |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
15985
diff
changeset
|
452 " Tests for "vaBiB", end could be wrong. |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
15985
diff
changeset
|
453 func Test_Visual_Block() |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
15985
diff
changeset
|
454 new |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
15985
diff
changeset
|
455 a |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
15985
diff
changeset
|
456 - Bug in "vPPPP" on this text: |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
15985
diff
changeset
|
457 { |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
15985
diff
changeset
|
458 cmd; |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
15985
diff
changeset
|
459 { |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
15985
diff
changeset
|
460 cmd;\t/* <-- Start cursor here */ |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
15985
diff
changeset
|
461 { |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
15985
diff
changeset
|
462 } |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
15985
diff
changeset
|
463 } |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
15985
diff
changeset
|
464 } |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
15985
diff
changeset
|
465 . |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
15985
diff
changeset
|
466 normal gg |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
15985
diff
changeset
|
467 call search('Start cursor here') |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
15985
diff
changeset
|
468 normal vaBiBD |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
15985
diff
changeset
|
469 call assert_equal(['- Bug in "vPPPP" on this text:', |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
15985
diff
changeset
|
470 \ "\t{", |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
15985
diff
changeset
|
471 \ "\t}"], getline(1, '$')) |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
15985
diff
changeset
|
472 |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
15985
diff
changeset
|
473 close! |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
15985
diff
changeset
|
474 endfunc |
18771
50fde4e20790
patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents:
16419
diff
changeset
|
475 |
50fde4e20790
patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents:
16419
diff
changeset
|
476 " Test for 'p'ut in visual block mode |
50fde4e20790
patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents:
16419
diff
changeset
|
477 func Test_visual_block_put() |
24725
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
478 new |
18771
50fde4e20790
patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents:
16419
diff
changeset
|
479 call append(0, ['One', 'Two', 'Three']) |
50fde4e20790
patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents:
16419
diff
changeset
|
480 normal gg |
50fde4e20790
patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents:
16419
diff
changeset
|
481 yank |
50fde4e20790
patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents:
16419
diff
changeset
|
482 call feedkeys("jl\<C-V>ljp", 'xt') |
50fde4e20790
patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents:
16419
diff
changeset
|
483 call assert_equal(['One', 'T', 'Tee', 'One', ''], getline(1, '$')) |
24725
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
484 bw! |
18771
50fde4e20790
patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents:
16419
diff
changeset
|
485 endfunc |
50fde4e20790
patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents:
16419
diff
changeset
|
486 |
30861
c33f094d20c1
patch 9.0.0765: with a Visual block a put command column may go negative
Bram Moolenaar <Bram@vim.org>
parents:
30735
diff
changeset
|
487 func Test_visual_block_put_invalid() |
c33f094d20c1
patch 9.0.0765: with a Visual block a put command column may go negative
Bram Moolenaar <Bram@vim.org>
parents:
30735
diff
changeset
|
488 enew! |
c33f094d20c1
patch 9.0.0765: with a Visual block a put command column may go negative
Bram Moolenaar <Bram@vim.org>
parents:
30735
diff
changeset
|
489 behave mswin |
c33f094d20c1
patch 9.0.0765: with a Visual block a put command column may go negative
Bram Moolenaar <Bram@vim.org>
parents:
30735
diff
changeset
|
490 norm yy |
c33f094d20c1
patch 9.0.0765: with a Visual block a put command column may go negative
Bram Moolenaar <Bram@vim.org>
parents:
30735
diff
changeset
|
491 norm v)Ps/^/ |
c33f094d20c1
patch 9.0.0765: with a Visual block a put command column may go negative
Bram Moolenaar <Bram@vim.org>
parents:
30735
diff
changeset
|
492 " this was causing the column to become negative |
c33f094d20c1
patch 9.0.0765: with a Visual block a put command column may go negative
Bram Moolenaar <Bram@vim.org>
parents:
30735
diff
changeset
|
493 silent norm ggv)P |
c33f094d20c1
patch 9.0.0765: with a Visual block a put command column may go negative
Bram Moolenaar <Bram@vim.org>
parents:
30735
diff
changeset
|
494 |
c33f094d20c1
patch 9.0.0765: with a Visual block a put command column may go negative
Bram Moolenaar <Bram@vim.org>
parents:
30735
diff
changeset
|
495 bwipe! |
c33f094d20c1
patch 9.0.0765: with a Visual block a put command column may go negative
Bram Moolenaar <Bram@vim.org>
parents:
30735
diff
changeset
|
496 behave xterm |
c33f094d20c1
patch 9.0.0765: with a Visual block a put command column may go negative
Bram Moolenaar <Bram@vim.org>
parents:
30735
diff
changeset
|
497 endfunc |
c33f094d20c1
patch 9.0.0765: with a Visual block a put command column may go negative
Bram Moolenaar <Bram@vim.org>
parents:
30735
diff
changeset
|
498 |
18804
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
499 " Visual modes (v V CTRL-V) followed by an operator; count; repeating |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
500 func Test_visual_mode_op() |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
501 new |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
502 call append(0, '') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
503 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
504 call setline(1, 'apple banana cherry') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
505 call cursor(1, 1) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
506 normal lvld.l3vd. |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
507 call assert_equal('a y', getline(1)) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
508 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
509 call setline(1, ['line 1 line 1', 'line 2 line 2', 'line 3 line 3', |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
510 \ 'line 4 line 4', 'line 5 line 5', 'line 6 line 6']) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
511 call cursor(1, 1) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
512 exe "normal Vcnewline\<Esc>j.j2Vd." |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
513 call assert_equal(['newline', 'newline'], getline(1, '$')) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
514 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
515 call deletebufline('', 1, '$') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
516 call setline(1, ['xxxxxxxxxxxxx', 'xxxxxxxxxxxxx', 'xxxxxxxxxxxxx', |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
517 \ 'xxxxxxxxxxxxx']) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
518 exe "normal \<C-V>jlc \<Esc>l.l2\<C-V>c----\<Esc>l." |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
519 call assert_equal([' --------x', |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
520 \ ' --------x', |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
521 \ 'xxxx--------x', |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
522 \ 'xxxx--------x'], getline(1, '$')) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
523 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
524 bwipe! |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
525 endfunc |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
526 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
527 " Visual mode maps (movement and text object) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
528 " Visual mode maps; count; repeating |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
529 " - Simple |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
530 " - With an Ex command (custom text object) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
531 func Test_visual_mode_maps() |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
532 new |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
533 call append(0, '') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
534 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
535 func SelectInCaps() |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
536 let [line1, col1] = searchpos('\u', 'bcnW') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
537 let [line2, col2] = searchpos('.\u', 'nW') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
538 call setpos("'<", [0, line1, col1, 0]) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
539 call setpos("'>", [0, line2, col2, 0]) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
540 normal! gv |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
541 endfunction |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
542 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
543 vnoremap W /\u/s-1<CR> |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
544 vnoremap iW :<C-U>call SelectInCaps()<CR> |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
545 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
546 call setline(1, 'KiwiRaspberryDateWatermelonPeach') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
547 call cursor(1, 1) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
548 exe "normal vWcNo\<Esc>l.fD2vd." |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
549 call assert_equal('NoNoberryach', getline(1)) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
550 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
551 call setline(1, 'JambuRambutanBananaTangerineMango') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
552 call cursor(1, 1) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
553 exe "normal llviWc-\<Esc>l.l2vdl." |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
554 call assert_equal('--ago', getline(1)) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
555 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
556 vunmap W |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
557 vunmap iW |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
558 bwipe! |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
559 delfunc SelectInCaps |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
560 endfunc |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
561 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
562 " Operator-pending mode maps (movement and text object) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
563 " - Simple |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
564 " - With Ex command moving the cursor |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
565 " - With Ex command and Visual selection (custom text object) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
566 func Test_visual_oper_pending_mode_maps() |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
567 new |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
568 call append(0, '') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
569 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
570 func MoveToCap() |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
571 call search('\u', 'W') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
572 endfunction |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
573 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
574 func SelectInCaps() |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
575 let [line1, col1] = searchpos('\u', 'bcnW') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
576 let [line2, col2] = searchpos('.\u', 'nW') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
577 call setpos("'<", [0, line1, col1, 0]) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
578 call setpos("'>", [0, line2, col2, 0]) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
579 normal! gv |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
580 endfunction |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
581 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
582 onoremap W /\u/<CR> |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
583 onoremap <Leader>W :<C-U>call MoveToCap()<CR> |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
584 onoremap iW :<C-U>call SelectInCaps()<CR> |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
585 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
586 call setline(1, 'PineappleQuinceLoganberryOrangeGrapefruitKiwiZ') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
587 call cursor(1, 1) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
588 exe "normal cW-\<Esc>l.l2.l." |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
589 call assert_equal('----Z', getline(1)) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
590 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
591 call setline(1, 'JuniperDurianZ') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
592 call cursor(1, 1) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
593 exe "normal g?\WfD." |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
594 call assert_equal('WhavcreQhevnaZ', getline(1)) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
595 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
596 call setline(1, 'LemonNectarineZ') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
597 call cursor(1, 1) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
598 exe "normal yiWPlciWNew\<Esc>fr." |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
599 call assert_equal('LemonNewNewZ', getline(1)) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
600 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
601 ounmap W |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
602 ounmap <Leader>W |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
603 ounmap iW |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
604 bwipe! |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
605 delfunc MoveToCap |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
606 delfunc SelectInCaps |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
607 endfunc |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
608 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
609 " Patch 7.3.879: Properly abort Operator-pending mode for "dv:<Esc>" etc. |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
610 func Test_op_pend_mode_abort() |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
611 new |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
612 call append(0, '') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
613 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
614 call setline(1, ['zzzz', 'zzzz']) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
615 call cursor(1, 1) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
616 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
617 exe "normal dV:\<CR>dv:\<CR>" |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
618 call assert_equal(['zzz'], getline(1, 2)) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
619 set nomodifiable |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
620 call assert_fails('exe "normal d:\<CR>"', 'E21:') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
621 set modifiable |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
622 call feedkeys("dv:\<Esc>dV:\<Esc>", 'xt') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
623 call assert_equal(['zzz'], getline(1, 2)) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
624 set nomodifiable |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
625 let v:errmsg = '' |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
626 call feedkeys("d:\<Esc>", 'xt') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
627 call assert_true(v:errmsg !~# '^E21:') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
628 set modifiable |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
629 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
630 bwipe! |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
631 endfunc |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
632 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
633 func Test_characterwise_visual_mode() |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
634 new |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
635 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
636 " characterwise visual mode: replace last line |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
637 $put ='a' |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
638 let @" = 'x' |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
639 normal v$p |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
640 call assert_equal('x', getline('$')) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
641 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
642 " characterwise visual mode: delete middle line |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
643 call deletebufline('', 1, '$') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
644 call append('$', ['a', 'b', 'c']) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
645 normal G |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
646 normal kkv$d |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
647 call assert_equal(['', 'b', 'c'], getline(1, '$')) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
648 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
649 " characterwise visual mode: delete middle two lines |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
650 call deletebufline('', 1, '$') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
651 call append('$', ['a', 'b', 'c']) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
652 normal Gkkvj$d |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
653 call assert_equal(['', 'c'], getline(1, '$')) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
654 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
655 " characterwise visual mode: delete last line |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
656 call deletebufline('', 1, '$') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
657 call append('$', ['a', 'b', 'c']) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
658 normal Gv$d |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
659 call assert_equal(['', 'a', 'b', ''], getline(1, '$')) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
660 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
661 " characterwise visual mode: delete last two lines |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
662 call deletebufline('', 1, '$') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
663 call append('$', ['a', 'b', 'c']) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
664 normal Gkvj$d |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
665 call assert_equal(['', 'a', ''], getline(1, '$')) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
666 |
22476
b3751f4d3b26
patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21923
diff
changeset
|
667 " characterwise visual mode: use a count with the visual mode from the last |
b3751f4d3b26
patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21923
diff
changeset
|
668 " line in the buffer |
b3751f4d3b26
patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21923
diff
changeset
|
669 %d _ |
b3751f4d3b26
patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21923
diff
changeset
|
670 call setline(1, ['one', 'two', 'three', 'four']) |
b3751f4d3b26
patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21923
diff
changeset
|
671 norm! vj$y |
b3751f4d3b26
patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21923
diff
changeset
|
672 norm! G1vy |
b3751f4d3b26
patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21923
diff
changeset
|
673 call assert_equal('four', @") |
b3751f4d3b26
patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21923
diff
changeset
|
674 |
24725
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
675 " characterwise visual mode: replace a single character line and the eol |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
676 %d _ |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
677 call setline(1, "a") |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
678 normal v$rx |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
679 call assert_equal(['x'], getline(1, '$')) |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
680 |
26587
b2bbc72183a5
patch 8.2.3823: test for visual replace is in wrong function
Bram Moolenaar <Bram@vim.org>
parents:
26581
diff
changeset
|
681 " replace a character with composing characters |
b2bbc72183a5
patch 8.2.3823: test for visual replace is in wrong function
Bram Moolenaar <Bram@vim.org>
parents:
26581
diff
changeset
|
682 call setline(1, "xã̳x") |
b2bbc72183a5
patch 8.2.3823: test for visual replace is in wrong function
Bram Moolenaar <Bram@vim.org>
parents:
26581
diff
changeset
|
683 normal gg0lvrb |
b2bbc72183a5
patch 8.2.3823: test for visual replace is in wrong function
Bram Moolenaar <Bram@vim.org>
parents:
26581
diff
changeset
|
684 call assert_equal("xbx", getline(1)) |
b2bbc72183a5
patch 8.2.3823: test for visual replace is in wrong function
Bram Moolenaar <Bram@vim.org>
parents:
26581
diff
changeset
|
685 |
18804
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
686 bwipe! |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
687 endfunc |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
688 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
689 func Test_visual_mode_put() |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
690 new |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
691 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
692 " v_p: replace last character with line register at middle line |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
693 call append('$', ['aaa', 'bbb', 'ccc']) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
694 normal G |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
695 -2yank |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
696 normal k$vp |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
697 call assert_equal(['', 'aaa', 'bb', 'aaa', '', 'ccc'], getline(1, '$')) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
698 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
699 " v_p: replace last character with line register at middle line selecting |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
700 " newline |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
701 call deletebufline('', 1, '$') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
702 call append('$', ['aaa', 'bbb', 'ccc']) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
703 normal G |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
704 -2yank |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
705 normal k$v$p |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
706 call assert_equal(['', 'aaa', 'bb', 'aaa', 'ccc'], getline(1, '$')) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
707 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
708 " v_p: replace last character with line register at last line |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
709 call deletebufline('', 1, '$') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
710 call append('$', ['aaa', 'bbb', 'ccc']) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
711 normal G |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
712 -2yank |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
713 normal $vp |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
714 call assert_equal(['', 'aaa', 'bbb', 'cc', 'aaa', ''], getline(1, '$')) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
715 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
716 " v_p: replace last character with line register at last line selecting |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
717 " newline |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
718 call deletebufline('', 1, '$') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
719 call append('$', ['aaa', 'bbb', 'ccc']) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
720 normal G |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
721 -2yank |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
722 normal $v$p |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
723 call assert_equal(['', 'aaa', 'bbb', 'cc', 'aaa', ''], getline(1, '$')) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
724 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
725 bwipe! |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
726 endfunc |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
727 |
19738
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19625
diff
changeset
|
728 func Test_gv_with_exclusive_selection() |
18804
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
729 new |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
730 |
19738
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19625
diff
changeset
|
731 " gv with exclusive selection after an operation |
18804
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
732 call append('$', ['zzz ', 'äà ']) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
733 set selection=exclusive |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
734 normal Gkv3lyjv3lpgvcxxx |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
735 call assert_equal(['', 'zzz ', 'xxx '], getline(1, '$')) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
736 |
19738
0208534b8a84
patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19625
diff
changeset
|
737 " gv with exclusive selection without an operation |
18804
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
738 call deletebufline('', 1, '$') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
739 call append('$', 'zzz ') |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
740 set selection=exclusive |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
741 exe "normal G0v3l\<Esc>gvcxxx" |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
742 call assert_equal(['', 'xxx '], getline(1, '$')) |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
743 |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
744 set selection&vim |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
745 bwipe! |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
746 endfunc |
2d41b63f52de
patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents:
18771
diff
changeset
|
747 |
18825
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
748 " Tests for the visual block mode commands |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
749 func Test_visual_block_mode() |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
750 new |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
751 call append(0, '') |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
752 call setline(1, repeat(['abcdefghijklm'], 5)) |
18825
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
753 call cursor(1, 1) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
754 |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
755 " Test shift-right of a block |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
756 exe "normal jllll\<C-V>jj>wll\<C-V>jlll>" |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
757 " Test shift-left of a block |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
758 exe "normal G$hhhh\<C-V>kk<" |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
759 " Test block-insert |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
760 exe "normal Gkl\<C-V>kkkIxyz" |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
761 " Test block-replace |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
762 exe "normal Gllll\<C-V>kkklllrq" |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
763 " Test block-change |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
764 exe "normal G$khhh\<C-V>hhkkcmno" |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
765 call assert_equal(['axyzbcdefghijklm', |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
766 \ 'axyzqqqq mno ghijklm', |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
767 \ 'axyzqqqqef mno ghijklm', |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
768 \ 'axyzqqqqefgmnoklm', |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
769 \ 'abcdqqqqijklm'], getline(1, 5)) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
770 |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
771 " Test 'C' to change till the end of the line |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
772 call cursor(3, 4) |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
773 exe "normal! \<C-V>j3lCooo" |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
774 call assert_equal(['axyooo', 'axyooo'], getline(3, 4)) |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
775 |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
776 " Test 'D' to delete till the end of the line |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
777 call cursor(3, 3) |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
778 exe "normal! \<C-V>j2lD" |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
779 call assert_equal(['ax', 'ax'], getline(3, 4)) |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
780 |
24725
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
781 " Test block insert with a short line that ends before the block |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
782 %d _ |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
783 call setline(1, [" one", "a", " two"]) |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
784 exe "normal gg\<C-V>2jIx" |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
785 call assert_equal([" xone", "a", " xtwo"], getline(1, '$')) |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
786 |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
787 " Test block append at EOL with '$' and without '$' |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
788 %d _ |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
789 call setline(1, ["one", "a", "two"]) |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
790 exe "normal gg$\<C-V>2jAx" |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
791 call assert_equal(["onex", "ax", "twox"], getline(1, '$')) |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
792 %d _ |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
793 call setline(1, ["one", "a", "two"]) |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
794 exe "normal gg3l\<C-V>2jAx" |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
795 call assert_equal(["onex", "a x", "twox"], getline(1, '$')) |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
796 |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
797 " Test block replace with an empty line in the middle and use $ to jump to |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
798 " the end of the line. |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
799 %d _ |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
800 call setline(1, ['one', '', 'two']) |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
801 exe "normal gg$\<C-V>2jrx" |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
802 call assert_equal(["onx", "", "twx"], getline(1, '$')) |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
803 |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
804 " Test block replace with an empty line in the middle and move cursor to the |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
805 " end of the line |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
806 %d _ |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
807 call setline(1, ['one', '', 'two']) |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
808 exe "normal gg2l\<C-V>2jrx" |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
809 call assert_equal(["onx", "", "twx"], getline(1, '$')) |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
810 |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
811 " Replace odd number of characters with a multibyte character |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
812 %d _ |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
813 call setline(1, ['abcd', 'efgh']) |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
814 exe "normal ggl\<C-V>2ljr\u1100" |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
815 call assert_equal(["a\u1100 ", "e\u1100 "], getline(1, '$')) |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
816 |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
817 " During visual block append, if the cursor moved outside of the selected |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
818 " range, then the edit should not be applied to the block. |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
819 %d _ |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
820 call setline(1, ['aaa', 'bbb', 'ccc']) |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
821 exe "normal 2G\<C-V>jAx\<Up>" |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
822 call assert_equal(['aaa', 'bxbb', 'ccc'], getline(1, '$')) |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
823 |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
824 " During visual block append, if the cursor is moved before the start of the |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
825 " block, then the new text should be appended there. |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
826 %d _ |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
827 call setline(1, ['aaa', 'bbb', 'ccc']) |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
828 exe "normal $\<C-V>2jA\<Left>x" |
25072
bd46322bea66
patch 8.2.3073: when cursor is move for block append wrong text is inserted
Bram Moolenaar <Bram@vim.org>
parents:
25070
diff
changeset
|
829 call assert_equal(['aaxa', 'bbxb', 'ccxc'], getline(1, '$')) |
24814
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24800
diff
changeset
|
830 " Repeat the previous test but use 'l' to move the cursor instead of '$' |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24800
diff
changeset
|
831 call setline(1, ['aaa', 'bbb', 'ccc']) |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24800
diff
changeset
|
832 exe "normal! gg2l\<C-V>2jA\<Left>x" |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24800
diff
changeset
|
833 call assert_equal(['aaxa', 'bbxb', 'ccxc'], getline(1, '$')) |
24725
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
834 |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
835 " Change a characterwise motion to a blockwise motion using CTRL-V |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
836 %d _ |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
837 call setline(1, ['123', '456', '789']) |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
838 exe "normal ld\<C-V>j" |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
839 call assert_equal(['13', '46', '789'], getline(1, '$')) |
3cdbce5ba73f
patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
840 |
24756
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
841 " Test from ':help v_b_I_example' |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
842 %d _ |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
843 setlocal tabstop=8 shiftwidth=4 |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
844 let lines =<< trim END |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
845 abcdefghijklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
846 abc defghijklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
847 abcdef ghi jklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
848 abcdefghijklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
849 END |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
850 call setline(1, lines) |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
851 exe "normal ggfo\<C-V>3jISTRING" |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
852 let expected =<< trim END |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
853 abcdefghijklmnSTRINGopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
854 abc STRING defghijklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
855 abcdef ghi STRING jklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
856 abcdefghijklmnSTRINGopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
857 END |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
858 call assert_equal(expected, getline(1, '$')) |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
859 |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
860 " Test from ':help v_b_A_example' |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
861 %d _ |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
862 let lines =<< trim END |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
863 abcdefghijklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
864 abc defghijklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
865 abcdef ghi jklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
866 abcdefghijklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
867 END |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
868 call setline(1, lines) |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
869 exe "normal ggfo\<C-V>3j$ASTRING" |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
870 let expected =<< trim END |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
871 abcdefghijklmnopqrstuvwxyzSTRING |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
872 abc defghijklmnopqrstuvwxyzSTRING |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
873 abcdef ghi jklmnopqrstuvwxyzSTRING |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
874 abcdefghijklmnopqrstuvwxyzSTRING |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
875 END |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
876 call assert_equal(expected, getline(1, '$')) |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
877 |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
878 " Test from ':help v_b_<_example' |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
879 %d _ |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
880 let lines =<< trim END |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
881 abcdefghijklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
882 abc defghijklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
883 abcdef ghi jklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
884 abcdefghijklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
885 END |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
886 call setline(1, lines) |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
887 exe "normal ggfo\<C-V>3j3l<.." |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
888 let expected =<< trim END |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
889 abcdefghijklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
890 abc defghijklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
891 abcdef ghi jklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
892 abcdefghijklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
893 END |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
894 call assert_equal(expected, getline(1, '$')) |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
895 |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
896 " Test from ':help v_b_>_example' |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
897 %d _ |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
898 let lines =<< trim END |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
899 abcdefghijklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
900 abc defghijklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
901 abcdef ghi jklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
902 abcdefghijklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
903 END |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
904 call setline(1, lines) |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
905 exe "normal ggfo\<C-V>3j>.." |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
906 let expected =<< trim END |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
907 abcdefghijklmn opqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
908 abc defghijklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
909 abcdef ghi jklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
910 abcdefghijklmn opqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
911 END |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
912 call assert_equal(expected, getline(1, '$')) |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
913 |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
914 " Test from ':help v_b_r_example' |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
915 %d _ |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
916 let lines =<< trim END |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
917 abcdefghijklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
918 abc defghijklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
919 abcdef ghi jklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
920 abcdefghijklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
921 END |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
922 call setline(1, lines) |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
923 exe "normal ggfo\<C-V>5l3jrX" |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
924 let expected =<< trim END |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
925 abcdefghijklmnXXXXXXuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
926 abc XXXXXXhijklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
927 abcdef ghi XXXXXX jklmnopqrstuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
928 abcdefghijklmnXXXXXXuvwxyz |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
929 END |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
930 call assert_equal(expected, getline(1, '$')) |
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
931 |
18825
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
932 bwipe! |
24756
ac7ad168caed
patch 8.2.2916: operators are not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24752
diff
changeset
|
933 set tabstop& shiftwidth& |
18825
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
934 endfunc |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
935 |
24800
b032da736676
patch 8.2.2938: after using motion force from feedkeys() it sticks
Bram Moolenaar <Bram@vim.org>
parents:
24756
diff
changeset
|
936 func Test_visual_force_motion_feedkeys() |
b032da736676
patch 8.2.2938: after using motion force from feedkeys() it sticks
Bram Moolenaar <Bram@vim.org>
parents:
24756
diff
changeset
|
937 onoremap <expr> i- execute('let g:mode = mode(1)')->slice(0, 0) |
b032da736676
patch 8.2.2938: after using motion force from feedkeys() it sticks
Bram Moolenaar <Bram@vim.org>
parents:
24756
diff
changeset
|
938 call feedkeys('dvi-', 'x') |
b032da736676
patch 8.2.2938: after using motion force from feedkeys() it sticks
Bram Moolenaar <Bram@vim.org>
parents:
24756
diff
changeset
|
939 call assert_equal('nov', g:mode) |
b032da736676
patch 8.2.2938: after using motion force from feedkeys() it sticks
Bram Moolenaar <Bram@vim.org>
parents:
24756
diff
changeset
|
940 call feedkeys('di-', 'x') |
b032da736676
patch 8.2.2938: after using motion force from feedkeys() it sticks
Bram Moolenaar <Bram@vim.org>
parents:
24756
diff
changeset
|
941 call assert_equal('no', g:mode) |
b032da736676
patch 8.2.2938: after using motion force from feedkeys() it sticks
Bram Moolenaar <Bram@vim.org>
parents:
24756
diff
changeset
|
942 ounmap i- |
b032da736676
patch 8.2.2938: after using motion force from feedkeys() it sticks
Bram Moolenaar <Bram@vim.org>
parents:
24756
diff
changeset
|
943 endfunc |
b032da736676
patch 8.2.2938: after using motion force from feedkeys() it sticks
Bram Moolenaar <Bram@vim.org>
parents:
24756
diff
changeset
|
944 |
18825
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
945 " Test block-insert using cursor keys for movement |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
946 func Test_visual_block_insert_cursor_keys() |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
947 new |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
948 call append(0, ['aaaaaa', 'bbbbbb', 'cccccc', 'dddddd']) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
949 call cursor(1, 1) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
950 |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
951 exe "norm! l\<C-V>jjjlllI\<Right>\<Right> \<Esc>" |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
952 call assert_equal(['aaa aaa', 'bbb bbb', 'ccc ccc', 'ddd ddd'], |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
953 \ getline(1, 4)) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
954 |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
955 call deletebufline('', 1, '$') |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
956 call setline(1, ['xaaa', 'bbbb', 'cccc', 'dddd']) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
957 call cursor(1, 1) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
958 exe "norm! \<C-V>jjjI<>\<Left>p\<Esc>" |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
959 call assert_equal(['<p>xaaa', '<p>bbbb', '<p>cccc', '<p>dddd'], |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
960 \ getline(1, 4)) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
961 bwipe! |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
962 endfunc |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
963 |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
964 func Test_visual_block_create() |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
965 new |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
966 call append(0, '') |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
967 " Test for Visual block was created with the last <C-v>$ |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
968 call setline(1, ['A23', '4567']) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
969 call cursor(1, 1) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
970 exe "norm! l\<C-V>j$Aab\<Esc>" |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
971 call assert_equal(['A23ab', '4567ab'], getline(1, 2)) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
972 |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
973 " Test for Visual block was created with the middle <C-v>$ (1) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
974 call deletebufline('', 1, '$') |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
975 call setline(1, ['B23', '4567']) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
976 call cursor(1, 1) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
977 exe "norm! l\<C-V>j$hAab\<Esc>" |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
978 call assert_equal(['B23 ab', '4567ab'], getline(1, 2)) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
979 |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
980 " Test for Visual block was created with the middle <C-v>$ (2) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
981 call deletebufline('', 1, '$') |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
982 call setline(1, ['C23', '4567']) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
983 call cursor(1, 1) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
984 exe "norm! l\<C-V>j$hhAab\<Esc>" |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
985 call assert_equal(['C23ab', '456ab7'], getline(1, 2)) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
986 bwipe! |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
987 endfunc |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
988 |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
989 " Test for Visual block insert when virtualedit=all |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
990 func Test_virtualedit_visual_block() |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
991 set ve=all |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
992 new |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
993 call append(0, ["\t\tline1", "\t\tline2", "\t\tline3"]) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
994 call cursor(1, 1) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
995 exe "norm! 07l\<C-V>jjIx\<Esc>" |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
996 call assert_equal([" x \tline1", |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
997 \ " x \tline2", |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
998 \ " x \tline3"], getline(1, 3)) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
999 |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1000 " Test for Visual block append when virtualedit=all |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1001 exe "norm! 012l\<C-v>jjAx\<Esc>" |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1002 call assert_equal([' x x line1', |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1003 \ ' x x line2', |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1004 \ ' x x line3'], getline(1, 3)) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1005 set ve= |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1006 bwipe! |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1007 endfunc |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1008 |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1009 " Test for changing case |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1010 func Test_visual_change_case() |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1011 new |
34344
be4389b04043
patch 9.1.0105: Style: typos found
Christian Brabandt <cb@256bit.org>
parents:
34336
diff
changeset
|
1012 " gUe must uppercase a whole word, also when ß changes to ẞ |
18825
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1013 exe "normal Gothe youtußeuu end\<Esc>Ypk0wgUe\r" |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1014 " gUfx must uppercase until x, inclusive. |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1015 exe "normal O- youßtußexu -\<Esc>0fogUfx\r" |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1016 " VU must uppercase a whole line |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1017 exe "normal YpkVU\r" |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1018 " same, when it's the last line in the buffer |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1019 exe "normal YPGi111\<Esc>VUddP\r" |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1020 " Uppercase two lines |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1021 exe "normal Oblah di\rdoh dut\<Esc>VkUj\r" |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1022 " Uppercase part of two lines |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1023 exe "normal ddppi333\<Esc>k0i222\<Esc>fyllvjfuUk" |
34336
d2ad8733db75
patch 9.1.0101: upper-case of German sharp s should be U+1E9E
Christian Brabandt <cb@256bit.org>
parents:
34174
diff
changeset
|
1024 call assert_equal(['the YOUTUẞEUU end', '- yOUẞTUẞEXu -', |
d2ad8733db75
patch 9.1.0101: upper-case of German sharp s should be U+1E9E
Christian Brabandt <cb@256bit.org>
parents:
34174
diff
changeset
|
1025 \ 'THE YOUTUẞEUU END', '111THE YOUTUẞEUU END', 'BLAH DI', 'DOH DUT', |
d2ad8733db75
patch 9.1.0101: upper-case of German sharp s should be U+1E9E
Christian Brabandt <cb@256bit.org>
parents:
34174
diff
changeset
|
1026 \ '222the yoUTUẞEUU END', '333THE YOUTUßeuu end'], getline(2, '$')) |
18825
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1027 bwipe! |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1028 endfunc |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1029 |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1030 " Test for Visual replace using Enter or NL |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1031 func Test_visual_replace_crnl() |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1032 new |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1033 exe "normal G3o123456789\e2k05l\<C-V>2jr\r" |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1034 exe "normal G3o98765\e2k02l\<C-V>2jr\<C-V>\r\n" |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1035 exe "normal G3o123456789\e2k05l\<C-V>2jr\n" |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1036 exe "normal G3o98765\e2k02l\<C-V>2jr\<C-V>\n" |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1037 call assert_equal(['12345', '789', '12345', '789', '12345', '789', "98\r65", |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1038 \ "98\r65", "98\r65", '12345', '789', '12345', '789', '12345', '789', |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1039 \ "98\n65", "98\n65", "98\n65"], getline(2, '$')) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1040 bwipe! |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1041 endfunc |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1042 |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1043 func Test_ve_block_curpos() |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1044 new |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1045 " Test cursor position. When ve=block and Visual block mode and $gj |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1046 call append(0, ['12345', '789']) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1047 call cursor(1, 3) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1048 set virtualedit=block |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1049 exe "norm! \<C-V>$gj\<Esc>" |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1050 call assert_equal([0, 2, 4, 0], getpos("'>")) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1051 set virtualedit= |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1052 bwipe! |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1053 endfunc |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1054 |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1055 " Test for block_insert when replacing spaces in front of the a with tabs |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1056 func Test_block_insert_replace_tabs() |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1057 new |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1058 set ts=8 sts=4 sw=4 |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1059 call append(0, ["#define BO_ALL\t 0x0001", |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1060 \ "#define BO_BS\t 0x0002", |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1061 \ "#define BO_CRSR\t 0x0004"]) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1062 call cursor(1, 1) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1063 exe "norm! f0\<C-V>2jI\<tab>\<esc>" |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1064 call assert_equal([ |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1065 \ "#define BO_ALL\t\t0x0001", |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1066 \ "#define BO_BS\t \t0x0002", |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1067 \ "#define BO_CRSR\t \t0x0004", ''], getline(1, '$')) |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1068 set ts& sts& sw& |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1069 bwipe! |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1070 endfunc |
70f1e352d599
patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents:
18804
diff
changeset
|
1071 |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18825
diff
changeset
|
1072 " Test for * register in : |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18825
diff
changeset
|
1073 func Test_star_register() |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18825
diff
changeset
|
1074 call assert_fails('*bfirst', 'E16:') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18825
diff
changeset
|
1075 new |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18825
diff
changeset
|
1076 call setline(1, ['foo', 'bar', 'baz', 'qux']) |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18825
diff
changeset
|
1077 exe "normal jVj\<ESC>" |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18825
diff
changeset
|
1078 *yank r |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18825
diff
changeset
|
1079 call assert_equal("bar\nbaz\n", @r) |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18825
diff
changeset
|
1080 |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18825
diff
changeset
|
1081 delmarks < > |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18825
diff
changeset
|
1082 call assert_fails('*yank', 'E20:') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18825
diff
changeset
|
1083 close! |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18825
diff
changeset
|
1084 endfunc |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
18825
diff
changeset
|
1085 |
19613
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
1086 " Test for changing text in visual mode with 'exclusive' selection |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
1087 func Test_exclusive_selection() |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
1088 new |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
1089 call setline(1, ['one', 'two']) |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
1090 set selection=exclusive |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
1091 call feedkeys("vwcabc", 'xt') |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
1092 call assert_equal('abctwo', getline(1)) |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
1093 call setline(1, ["\tone"]) |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
1094 set virtualedit=all |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
1095 call feedkeys('0v2lcl', 'xt') |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
1096 call assert_equal('l one', getline(1)) |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
1097 set virtualedit& |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
1098 set selection& |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
1099 close! |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
1100 endfunc |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
1101 |
22502
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1102 " Test for starting linewise visual with a count. |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1103 " This test needs to be run without any previous visual mode. Otherwise the |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1104 " count will use the count from the previous visual mode. |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1105 func Test_linewise_visual_with_count() |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1106 let after =<< trim [CODE] |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1107 call setline(1, ['one', 'two', 'three', 'four']) |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1108 norm! 3Vy |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1109 call assert_equal("one\ntwo\nthree\n", @") |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1110 call writefile(v:errors, 'Xtestout') |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1111 qall! |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1112 [CODE] |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1113 if RunVim([], after, '') |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1114 call assert_equal([], readfile('Xtestout')) |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1115 call delete('Xtestout') |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1116 endif |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1117 endfunc |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1118 |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1119 " Test for starting characterwise visual with a count. |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1120 " This test needs to be run without any previous visual mode. Otherwise the |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1121 " count will use the count from the previous visual mode. |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1122 func Test_characterwise_visual_with_count() |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1123 let after =<< trim [CODE] |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1124 call setline(1, ['one two', 'three']) |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1125 norm! l5vy |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1126 call assert_equal("ne tw", @") |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1127 call writefile(v:errors, 'Xtestout') |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1128 qall! |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1129 [CODE] |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1130 if RunVim([], after, '') |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1131 call assert_equal([], readfile('Xtestout')) |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1132 call delete('Xtestout') |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
1133 endif |
19613
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
1134 endfunc |
9c15be376631
patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
1135 |
20199
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
1136 " Test for visually selecting an inner block (iB) |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
1137 func Test_visual_inner_block() |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
1138 new |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
1139 call setline(1, ['one', '{', 'two', '{', 'three', '}', 'four', '}', 'five']) |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
1140 call cursor(5, 1) |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
1141 " visually select all the lines in the block and then execute iB |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
1142 call feedkeys("ViB\<C-C>", 'xt') |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
1143 call assert_equal([0, 5, 1, 0], getpos("'<")) |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
1144 call assert_equal([0, 5, 6, 0], getpos("'>")) |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
1145 " visually select two inner blocks |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
1146 call feedkeys("ViBiB\<C-C>", 'xt') |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
1147 call assert_equal([0, 3, 1, 0], getpos("'<")) |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
1148 call assert_equal([0, 7, 5, 0], getpos("'>")) |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
1149 " try to select non-existing inner block |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
1150 call cursor(5, 1) |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
1151 call assert_beeps('normal ViBiBiB') |
34678
75f7b311ee25
patch 9.1.0220: Few typos in source and test files
Christian Brabandt <cb@256bit.org>
parents:
34527
diff
changeset
|
1152 " try to select an unclosed inner block |
20199
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
1153 8,9d |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
1154 call cursor(5, 1) |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
1155 call assert_beeps('normal ViBiB') |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
1156 close! |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
1157 endfunc |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
1158 |
21923
2626306efe44
patch 8.2.1511: putting a string in Visual block mode ignores multi-byte
Bram Moolenaar <Bram@vim.org>
parents:
20941
diff
changeset
|
1159 func Test_visual_put_in_block() |
2626306efe44
patch 8.2.1511: putting a string in Visual block mode ignores multi-byte
Bram Moolenaar <Bram@vim.org>
parents:
20941
diff
changeset
|
1160 new |
2626306efe44
patch 8.2.1511: putting a string in Visual block mode ignores multi-byte
Bram Moolenaar <Bram@vim.org>
parents:
20941
diff
changeset
|
1161 call setline(1, ['xxxx', 'y∞yy', 'zzzz']) |
2626306efe44
patch 8.2.1511: putting a string in Visual block mode ignores multi-byte
Bram Moolenaar <Bram@vim.org>
parents:
20941
diff
changeset
|
1162 normal 1G2yl |
2626306efe44
patch 8.2.1511: putting a string in Visual block mode ignores multi-byte
Bram Moolenaar <Bram@vim.org>
parents:
20941
diff
changeset
|
1163 exe "normal 1G2l\<C-V>jjlp" |
2626306efe44
patch 8.2.1511: putting a string in Visual block mode ignores multi-byte
Bram Moolenaar <Bram@vim.org>
parents:
20941
diff
changeset
|
1164 call assert_equal(['xxxx', 'y∞xx', 'zzxx'], getline(1, 3)) |
2626306efe44
patch 8.2.1511: putting a string in Visual block mode ignores multi-byte
Bram Moolenaar <Bram@vim.org>
parents:
20941
diff
changeset
|
1165 bwipe! |
2626306efe44
patch 8.2.1511: putting a string in Visual block mode ignores multi-byte
Bram Moolenaar <Bram@vim.org>
parents:
20941
diff
changeset
|
1166 endfunc |
2626306efe44
patch 8.2.1511: putting a string in Visual block mode ignores multi-byte
Bram Moolenaar <Bram@vim.org>
parents:
20941
diff
changeset
|
1167 |
24752
1ce39e257f1b
patch 8.2.2914: cannot paste a block without adding padding
Bram Moolenaar <Bram@vim.org>
parents:
24725
diff
changeset
|
1168 func Test_visual_put_in_block_using_zp() |
1ce39e257f1b
patch 8.2.2914: cannot paste a block without adding padding
Bram Moolenaar <Bram@vim.org>
parents:
24725
diff
changeset
|
1169 new |
1ce39e257f1b
patch 8.2.2914: cannot paste a block without adding padding
Bram Moolenaar <Bram@vim.org>
parents:
24725
diff
changeset
|
1170 " paste using zP |
31849
dbec60b8c253
patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents:
31680
diff
changeset
|
1171 call setline(1, ['/path;text', '/path;text', '/path;text', '', |
dbec60b8c253
patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents:
31680
diff
changeset
|
1172 \ '/subdir', |
24752
1ce39e257f1b
patch 8.2.2914: cannot paste a block without adding padding
Bram Moolenaar <Bram@vim.org>
parents:
24725
diff
changeset
|
1173 \ '/longsubdir', |
1ce39e257f1b
patch 8.2.2914: cannot paste a block without adding padding
Bram Moolenaar <Bram@vim.org>
parents:
24725
diff
changeset
|
1174 \ '/longlongsubdir']) |
1ce39e257f1b
patch 8.2.2914: cannot paste a block without adding padding
Bram Moolenaar <Bram@vim.org>
parents:
24725
diff
changeset
|
1175 exe "normal! 5G\<c-v>2j$y" |
1ce39e257f1b
patch 8.2.2914: cannot paste a block without adding padding
Bram Moolenaar <Bram@vim.org>
parents:
24725
diff
changeset
|
1176 norm! 1Gf;zP |
1ce39e257f1b
patch 8.2.2914: cannot paste a block without adding padding
Bram Moolenaar <Bram@vim.org>
parents:
24725
diff
changeset
|
1177 call assert_equal(['/path/subdir;text', '/path/longsubdir;text', '/path/longlongsubdir;text'], getline(1, 3)) |
1ce39e257f1b
patch 8.2.2914: cannot paste a block without adding padding
Bram Moolenaar <Bram@vim.org>
parents:
24725
diff
changeset
|
1178 %d |
1ce39e257f1b
patch 8.2.2914: cannot paste a block without adding padding
Bram Moolenaar <Bram@vim.org>
parents:
24725
diff
changeset
|
1179 " paste using zP |
31849
dbec60b8c253
patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents:
31680
diff
changeset
|
1180 call setline(1, ['/path;text', '/path;text', '/path;text', '', |
dbec60b8c253
patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents:
31680
diff
changeset
|
1181 \ '/subdir', |
24752
1ce39e257f1b
patch 8.2.2914: cannot paste a block without adding padding
Bram Moolenaar <Bram@vim.org>
parents:
24725
diff
changeset
|
1182 \ '/longsubdir', |
1ce39e257f1b
patch 8.2.2914: cannot paste a block without adding padding
Bram Moolenaar <Bram@vim.org>
parents:
24725
diff
changeset
|
1183 \ '/longlongsubdir']) |
1ce39e257f1b
patch 8.2.2914: cannot paste a block without adding padding
Bram Moolenaar <Bram@vim.org>
parents:
24725
diff
changeset
|
1184 exe "normal! 5G\<c-v>2j$y" |
1ce39e257f1b
patch 8.2.2914: cannot paste a block without adding padding
Bram Moolenaar <Bram@vim.org>
parents:
24725
diff
changeset
|
1185 norm! 1Gf;hzp |
1ce39e257f1b
patch 8.2.2914: cannot paste a block without adding padding
Bram Moolenaar <Bram@vim.org>
parents:
24725
diff
changeset
|
1186 call assert_equal(['/path/subdir;text', '/path/longsubdir;text', '/path/longlongsubdir;text'], getline(1, 3)) |
1ce39e257f1b
patch 8.2.2914: cannot paste a block without adding padding
Bram Moolenaar <Bram@vim.org>
parents:
24725
diff
changeset
|
1187 bwipe! |
1ce39e257f1b
patch 8.2.2914: cannot paste a block without adding padding
Bram Moolenaar <Bram@vim.org>
parents:
24725
diff
changeset
|
1188 endfunc |
1ce39e257f1b
patch 8.2.2914: cannot paste a block without adding padding
Bram Moolenaar <Bram@vim.org>
parents:
24725
diff
changeset
|
1189 |
24866
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1190 func Test_visual_put_in_block_using_zy_and_zp() |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1191 new |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1192 |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1193 " Test 1) Paste using zp - after the cursor without trailing spaces |
31849
dbec60b8c253
patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents:
31680
diff
changeset
|
1194 call setline(1, ['/path;text', '/path;text', '/path;text', '', |
24866
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1195 \ 'texttext /subdir columntext', |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1196 \ 'texttext /longsubdir columntext', |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1197 \ 'texttext /longlongsubdir columntext']) |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1198 exe "normal! 5G0f/\<c-v>2jezy" |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1199 norm! 1G0f;hzp |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1200 call assert_equal(['/path/subdir;text', '/path/longsubdir;text', '/path/longlongsubdir;text'], getline(1, 3)) |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1201 |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1202 " Test 2) Paste using zP - in front of the cursor without trailing spaces |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1203 %d |
31849
dbec60b8c253
patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents:
31680
diff
changeset
|
1204 call setline(1, ['/path;text', '/path;text', '/path;text', '', |
24866
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1205 \ 'texttext /subdir columntext', |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1206 \ 'texttext /longsubdir columntext', |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1207 \ 'texttext /longlongsubdir columntext']) |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1208 exe "normal! 5G0f/\<c-v>2jezy" |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1209 norm! 1G0f;zP |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1210 call assert_equal(['/path/subdir;text', '/path/longsubdir;text', '/path/longlongsubdir;text'], getline(1, 3)) |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1211 |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1212 " Test 3) Paste using p - with trailing spaces |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1213 %d |
31849
dbec60b8c253
patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents:
31680
diff
changeset
|
1214 call setline(1, ['/path;text', '/path;text', '/path;text', '', |
24866
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1215 \ 'texttext /subdir columntext', |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1216 \ 'texttext /longsubdir columntext', |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1217 \ 'texttext /longlongsubdir columntext']) |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1218 exe "normal! 5G0f/\<c-v>2jezy" |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1219 norm! 1G0f;hp |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1220 call assert_equal(['/path/subdir ;text', '/path/longsubdir ;text', '/path/longlongsubdir;text'], getline(1, 3)) |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1221 |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1222 " Test 4) Paste using P - with trailing spaces |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1223 %d |
31849
dbec60b8c253
patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents:
31680
diff
changeset
|
1224 call setline(1, ['/path;text', '/path;text', '/path;text', '', |
24866
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1225 \ 'texttext /subdir columntext', |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1226 \ 'texttext /longsubdir columntext', |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1227 \ 'texttext /longlongsubdir columntext']) |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1228 exe "normal! 5G0f/\<c-v>2jezy" |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1229 norm! 1G0f;P |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1230 call assert_equal(['/path/subdir ;text', '/path/longsubdir ;text', '/path/longlongsubdir;text'], getline(1, 3)) |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1231 |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1232 " Test 5) Yank with spaces inside the block |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1233 %d |
31849
dbec60b8c253
patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents:
31680
diff
changeset
|
1234 call setline(1, ['/path;text', '/path;text', '/path;text', '', |
24866
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1235 \ 'texttext /sub dir/ columntext', |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1236 \ 'texttext /lon gsubdir/ columntext', |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1237 \ 'texttext /lon glongsubdir/ columntext']) |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1238 exe "normal! 5G0f/\<c-v>2jf/zy" |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1239 norm! 1G0f;zP |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1240 call assert_equal(['/path/sub dir/;text', '/path/lon gsubdir/;text', '/path/lon glongsubdir/;text'], getline(1, 3)) |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1241 bwipe! |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1242 endfunc |
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1243 |
25070
f397a21b3e4c
patch 8.2.3072: "zy" does not work well when "virtualedit' is "block"
Bram Moolenaar <Bram@vim.org>
parents:
24866
diff
changeset
|
1244 func Test_visual_put_blockedit_zy_and_zp() |
f397a21b3e4c
patch 8.2.3072: "zy" does not work well when "virtualedit' is "block"
Bram Moolenaar <Bram@vim.org>
parents:
24866
diff
changeset
|
1245 new |
f397a21b3e4c
patch 8.2.3072: "zy" does not work well when "virtualedit' is "block"
Bram Moolenaar <Bram@vim.org>
parents:
24866
diff
changeset
|
1246 |
f397a21b3e4c
patch 8.2.3072: "zy" does not work well when "virtualedit' is "block"
Bram Moolenaar <Bram@vim.org>
parents:
24866
diff
changeset
|
1247 call setline(1, ['aa', 'bbbbb', 'ccc', '', 'XX', 'GGHHJ', 'RTZU']) |
f397a21b3e4c
patch 8.2.3072: "zy" does not work well when "virtualedit' is "block"
Bram Moolenaar <Bram@vim.org>
parents:
24866
diff
changeset
|
1248 exe "normal! gg0\<c-v>2j$zy" |
f397a21b3e4c
patch 8.2.3072: "zy" does not work well when "virtualedit' is "block"
Bram Moolenaar <Bram@vim.org>
parents:
24866
diff
changeset
|
1249 norm! 5gg0zP |
f397a21b3e4c
patch 8.2.3072: "zy" does not work well when "virtualedit' is "block"
Bram Moolenaar <Bram@vim.org>
parents:
24866
diff
changeset
|
1250 call assert_equal(['aa', 'bbbbb', 'ccc', '', 'aaXX', 'bbbbbGGHHJ', 'cccRTZU'], getline(1, 7)) |
f397a21b3e4c
patch 8.2.3072: "zy" does not work well when "virtualedit' is "block"
Bram Moolenaar <Bram@vim.org>
parents:
24866
diff
changeset
|
1251 " |
f397a21b3e4c
patch 8.2.3072: "zy" does not work well when "virtualedit' is "block"
Bram Moolenaar <Bram@vim.org>
parents:
24866
diff
changeset
|
1252 " now with blockmode editing |
f397a21b3e4c
patch 8.2.3072: "zy" does not work well when "virtualedit' is "block"
Bram Moolenaar <Bram@vim.org>
parents:
24866
diff
changeset
|
1253 sil %d |
f397a21b3e4c
patch 8.2.3072: "zy" does not work well when "virtualedit' is "block"
Bram Moolenaar <Bram@vim.org>
parents:
24866
diff
changeset
|
1254 :set ve=block |
f397a21b3e4c
patch 8.2.3072: "zy" does not work well when "virtualedit' is "block"
Bram Moolenaar <Bram@vim.org>
parents:
24866
diff
changeset
|
1255 call setline(1, ['aa', 'bbbbb', 'ccc', '', 'XX', 'GGHHJ', 'RTZU']) |
f397a21b3e4c
patch 8.2.3072: "zy" does not work well when "virtualedit' is "block"
Bram Moolenaar <Bram@vim.org>
parents:
24866
diff
changeset
|
1256 exe "normal! gg0\<c-v>2j$zy" |
f397a21b3e4c
patch 8.2.3072: "zy" does not work well when "virtualedit' is "block"
Bram Moolenaar <Bram@vim.org>
parents:
24866
diff
changeset
|
1257 norm! 5gg0zP |
f397a21b3e4c
patch 8.2.3072: "zy" does not work well when "virtualedit' is "block"
Bram Moolenaar <Bram@vim.org>
parents:
24866
diff
changeset
|
1258 call assert_equal(['aa', 'bbbbb', 'ccc', '', 'aaXX', 'bbbbbGGHHJ', 'cccRTZU'], getline(1, 7)) |
f397a21b3e4c
patch 8.2.3072: "zy" does not work well when "virtualedit' is "block"
Bram Moolenaar <Bram@vim.org>
parents:
24866
diff
changeset
|
1259 set ve&vim |
f397a21b3e4c
patch 8.2.3072: "zy" does not work well when "virtualedit' is "block"
Bram Moolenaar <Bram@vim.org>
parents:
24866
diff
changeset
|
1260 bw! |
f397a21b3e4c
patch 8.2.3072: "zy" does not work well when "virtualedit' is "block"
Bram Moolenaar <Bram@vim.org>
parents:
24866
diff
changeset
|
1261 endfunc |
f397a21b3e4c
patch 8.2.3072: "zy" does not work well when "virtualedit' is "block"
Bram Moolenaar <Bram@vim.org>
parents:
24866
diff
changeset
|
1262 |
27382
123b0747fa10
patch 8.2.4219: reading before the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
27378
diff
changeset
|
1263 func Test_visual_block_yank_zy() |
123b0747fa10
patch 8.2.4219: reading before the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
27378
diff
changeset
|
1264 new |
123b0747fa10
patch 8.2.4219: reading before the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
27378
diff
changeset
|
1265 " this was reading before the start of the line |
123b0747fa10
patch 8.2.4219: reading before the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
27378
diff
changeset
|
1266 exe "norm o\<C-T>\<Esc>\<C-V>zy" |
123b0747fa10
patch 8.2.4219: reading before the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
27378
diff
changeset
|
1267 bwipe! |
123b0747fa10
patch 8.2.4219: reading before the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
27378
diff
changeset
|
1268 endfunc |
123b0747fa10
patch 8.2.4219: reading before the start of the line
Bram Moolenaar <Bram@vim.org>
parents:
27378
diff
changeset
|
1269 |
25102
b7062becbfb5
patch 8.2.3088: with 'virtualedit' set to "block" Visual highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents:
25072
diff
changeset
|
1270 func Test_visual_block_with_virtualedit() |
b7062becbfb5
patch 8.2.3088: with 'virtualedit' set to "block" Visual highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents:
25072
diff
changeset
|
1271 CheckScreendump |
b7062becbfb5
patch 8.2.3088: with 'virtualedit' set to "block" Visual highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents:
25072
diff
changeset
|
1272 |
b7062becbfb5
patch 8.2.3088: with 'virtualedit' set to "block" Visual highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents:
25072
diff
changeset
|
1273 let lines =<< trim END |
b7062becbfb5
patch 8.2.3088: with 'virtualedit' set to "block" Visual highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents:
25072
diff
changeset
|
1274 call setline(1, ['aaaaaa', 'bbbb', 'cc']) |
b7062becbfb5
patch 8.2.3088: with 'virtualedit' set to "block" Visual highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents:
25072
diff
changeset
|
1275 set virtualedit=block |
b7062becbfb5
patch 8.2.3088: with 'virtualedit' set to "block" Visual highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents:
25072
diff
changeset
|
1276 normal G |
b7062becbfb5
patch 8.2.3088: with 'virtualedit' set to "block" Visual highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents:
25072
diff
changeset
|
1277 END |
30867
0913cd44fdfa
patch 9.0.0768: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30861
diff
changeset
|
1278 call writefile(lines, 'XTest_block', 'D') |
25102
b7062becbfb5
patch 8.2.3088: with 'virtualedit' set to "block" Visual highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents:
25072
diff
changeset
|
1279 |
b7062becbfb5
patch 8.2.3088: with 'virtualedit' set to "block" Visual highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents:
25072
diff
changeset
|
1280 let buf = RunVimInTerminal('-S XTest_block', {'rows': 8, 'cols': 50}) |
b7062becbfb5
patch 8.2.3088: with 'virtualedit' set to "block" Visual highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents:
25072
diff
changeset
|
1281 call term_sendkeys(buf, "\<C-V>gg$") |
b7062becbfb5
patch 8.2.3088: with 'virtualedit' set to "block" Visual highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents:
25072
diff
changeset
|
1282 call VerifyScreenDump(buf, 'Test_visual_block_with_virtualedit', {}) |
b7062becbfb5
patch 8.2.3088: with 'virtualedit' set to "block" Visual highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents:
25072
diff
changeset
|
1283 |
25116
56817e74d106
patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents:
25102
diff
changeset
|
1284 call term_sendkeys(buf, "\<Esc>gg\<C-V>G$") |
56817e74d106
patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents:
25102
diff
changeset
|
1285 call VerifyScreenDump(buf, 'Test_visual_block_with_virtualedit2', {}) |
56817e74d106
patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents:
25102
diff
changeset
|
1286 |
25102
b7062becbfb5
patch 8.2.3088: with 'virtualedit' set to "block" Visual highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents:
25072
diff
changeset
|
1287 " clean up |
b7062becbfb5
patch 8.2.3088: with 'virtualedit' set to "block" Visual highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents:
25072
diff
changeset
|
1288 call term_sendkeys(buf, "\<Esc>") |
b7062becbfb5
patch 8.2.3088: with 'virtualedit' set to "block" Visual highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents:
25072
diff
changeset
|
1289 call StopVimInTerminal(buf) |
b7062becbfb5
patch 8.2.3088: with 'virtualedit' set to "block" Visual highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents:
25072
diff
changeset
|
1290 endfunc |
b7062becbfb5
patch 8.2.3088: with 'virtualedit' set to "block" Visual highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents:
25072
diff
changeset
|
1291 |
26159
34606aec52b3
patch 8.2.3611: crash when using CTRL-W f without finding a file name
Bram Moolenaar <Bram@vim.org>
parents:
25921
diff
changeset
|
1292 func Test_visual_block_ctrl_w_f() |
30986
360f286b5869
patch 9.0.0828: various typos
Bram Moolenaar <Bram@vim.org>
parents:
30867
diff
changeset
|
1293 " Empty block selected in new buffer should not result in an error. |
26159
34606aec52b3
patch 8.2.3611: crash when using CTRL-W f without finding a file name
Bram Moolenaar <Bram@vim.org>
parents:
25921
diff
changeset
|
1294 au! BufNew foo sil norm f |
34606aec52b3
patch 8.2.3611: crash when using CTRL-W f without finding a file name
Bram Moolenaar <Bram@vim.org>
parents:
25921
diff
changeset
|
1295 edit foo |
34606aec52b3
patch 8.2.3611: crash when using CTRL-W f without finding a file name
Bram Moolenaar <Bram@vim.org>
parents:
25921
diff
changeset
|
1296 |
34606aec52b3
patch 8.2.3611: crash when using CTRL-W f without finding a file name
Bram Moolenaar <Bram@vim.org>
parents:
25921
diff
changeset
|
1297 au! BufNew |
34606aec52b3
patch 8.2.3611: crash when using CTRL-W f without finding a file name
Bram Moolenaar <Bram@vim.org>
parents:
25921
diff
changeset
|
1298 endfunc |
34606aec52b3
patch 8.2.3611: crash when using CTRL-W f without finding a file name
Bram Moolenaar <Bram@vim.org>
parents:
25921
diff
changeset
|
1299 |
27183
be5e01f3ee3b
patch 8.2.4120: block insert goes over the end of the line
Bram Moolenaar <Bram@vim.org>
parents:
26587
diff
changeset
|
1300 func Test_visual_block_append_invalid_char() |
be5e01f3ee3b
patch 8.2.4120: block insert goes over the end of the line
Bram Moolenaar <Bram@vim.org>
parents:
26587
diff
changeset
|
1301 " this was going over the end of the line |
27185
353b71688c9d
patch 8.2.4121: Visual test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
27183
diff
changeset
|
1302 set isprint=@,161-255 |
27183
be5e01f3ee3b
patch 8.2.4120: block insert goes over the end of the line
Bram Moolenaar <Bram@vim.org>
parents:
26587
diff
changeset
|
1303 new |
be5e01f3ee3b
patch 8.2.4120: block insert goes over the end of the line
Bram Moolenaar <Bram@vim.org>
parents:
26587
diff
changeset
|
1304 call setline(1, [' let xxx', 'xxxxx', 'xxxxxxxxxxx']) |
be5e01f3ee3b
patch 8.2.4120: block insert goes over the end of the line
Bram Moolenaar <Bram@vim.org>
parents:
26587
diff
changeset
|
1305 exe "normal 0\<C-V>jjA-\<Esc>" |
be5e01f3ee3b
patch 8.2.4120: block insert goes over the end of the line
Bram Moolenaar <Bram@vim.org>
parents:
26587
diff
changeset
|
1306 call assert_equal([' - let xxx', 'xxxxx -', 'xxxxxxxx-xxx'], getline(1, 3)) |
be5e01f3ee3b
patch 8.2.4120: block insert goes over the end of the line
Bram Moolenaar <Bram@vim.org>
parents:
26587
diff
changeset
|
1307 bwipe! |
27185
353b71688c9d
patch 8.2.4121: Visual test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
27183
diff
changeset
|
1308 set isprint& |
27183
be5e01f3ee3b
patch 8.2.4120: block insert goes over the end of the line
Bram Moolenaar <Bram@vim.org>
parents:
26587
diff
changeset
|
1309 endfunc |
be5e01f3ee3b
patch 8.2.4120: block insert goes over the end of the line
Bram Moolenaar <Bram@vim.org>
parents:
26587
diff
changeset
|
1310 |
28893
aa44d5842d6c
patch 8.2.4969: changing text in Visual mode may cause invalid memory access
Bram Moolenaar <Bram@vim.org>
parents:
28714
diff
changeset
|
1311 func Test_visual_block_with_substitute() |
aa44d5842d6c
patch 8.2.4969: changing text in Visual mode may cause invalid memory access
Bram Moolenaar <Bram@vim.org>
parents:
28714
diff
changeset
|
1312 " this was reading beyond the end of the line |
aa44d5842d6c
patch 8.2.4969: changing text in Visual mode may cause invalid memory access
Bram Moolenaar <Bram@vim.org>
parents:
28714
diff
changeset
|
1313 new |
aa44d5842d6c
patch 8.2.4969: changing text in Visual mode may cause invalid memory access
Bram Moolenaar <Bram@vim.org>
parents:
28714
diff
changeset
|
1314 norm a0) |
aa44d5842d6c
patch 8.2.4969: changing text in Visual mode may cause invalid memory access
Bram Moolenaar <Bram@vim.org>
parents:
28714
diff
changeset
|
1315 sil! norm O |
aa44d5842d6c
patch 8.2.4969: changing text in Visual mode may cause invalid memory access
Bram Moolenaar <Bram@vim.org>
parents:
28714
diff
changeset
|
1316 s/) |
aa44d5842d6c
patch 8.2.4969: changing text in Visual mode may cause invalid memory access
Bram Moolenaar <Bram@vim.org>
parents:
28714
diff
changeset
|
1317 sil! norm |
aa44d5842d6c
patch 8.2.4969: changing text in Visual mode may cause invalid memory access
Bram Moolenaar <Bram@vim.org>
parents:
28714
diff
changeset
|
1318 bwipe! |
aa44d5842d6c
patch 8.2.4969: changing text in Visual mode may cause invalid memory access
Bram Moolenaar <Bram@vim.org>
parents:
28714
diff
changeset
|
1319 endfunc |
aa44d5842d6c
patch 8.2.4969: changing text in Visual mode may cause invalid memory access
Bram Moolenaar <Bram@vim.org>
parents:
28714
diff
changeset
|
1320 |
25921
203b0f3a741a
patch 8.2.3494: illegal memory access in utf_head_off
Bram Moolenaar <Bram@vim.org>
parents:
25118
diff
changeset
|
1321 func Test_visual_reselect_with_count() |
31881
df061831a85f
patch 9.0.1273: "1v" may select block with wrong size
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
1322 enew |
df061831a85f
patch 9.0.1273: "1v" may select block with wrong size
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
1323 call setline(1, ['aaaaaa', '✗ bbbb', '✗ bbbb']) |
df061831a85f
patch 9.0.1273: "1v" may select block with wrong size
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
1324 exe "normal! 2Gw\<C-V>jed" |
df061831a85f
patch 9.0.1273: "1v" may select block with wrong size
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
1325 exe "normal! gg0lP" |
df061831a85f
patch 9.0.1273: "1v" may select block with wrong size
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
1326 call assert_equal(['abbbbaaaaa', '✗bbbb ', '✗ '], getline(1, '$')) |
df061831a85f
patch 9.0.1273: "1v" may select block with wrong size
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
1327 |
df061831a85f
patch 9.0.1273: "1v" may select block with wrong size
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
1328 exe "normal! 1vr." |
df061831a85f
patch 9.0.1273: "1v" may select block with wrong size
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
1329 call assert_equal(['a....aaaaa', '✗.... ', '✗ '], getline(1, '$')) |
df061831a85f
patch 9.0.1273: "1v" may select block with wrong size
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
1330 |
df061831a85f
patch 9.0.1273: "1v" may select block with wrong size
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
1331 bwipe! |
df061831a85f
patch 9.0.1273: "1v" may select block with wrong size
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
1332 |
25921
203b0f3a741a
patch 8.2.3494: illegal memory access in utf_head_off
Bram Moolenaar <Bram@vim.org>
parents:
25118
diff
changeset
|
1333 " this was causing an illegal memory access |
203b0f3a741a
patch 8.2.3494: illegal memory access in utf_head_off
Bram Moolenaar <Bram@vim.org>
parents:
25118
diff
changeset
|
1334 let lines =<< trim END |
203b0f3a741a
patch 8.2.3494: illegal memory access in utf_head_off
Bram Moolenaar <Bram@vim.org>
parents:
25118
diff
changeset
|
1335 |
203b0f3a741a
patch 8.2.3494: illegal memory access in utf_head_off
Bram Moolenaar <Bram@vim.org>
parents:
25118
diff
changeset
|
1336 |
203b0f3a741a
patch 8.2.3494: illegal memory access in utf_head_off
Bram Moolenaar <Bram@vim.org>
parents:
25118
diff
changeset
|
1337 |
203b0f3a741a
patch 8.2.3494: illegal memory access in utf_head_off
Bram Moolenaar <Bram@vim.org>
parents:
25118
diff
changeset
|
1338 : |
203b0f3a741a
patch 8.2.3494: illegal memory access in utf_head_off
Bram Moolenaar <Bram@vim.org>
parents:
25118
diff
changeset
|
1339 r<sfile> |
203b0f3a741a
patch 8.2.3494: illegal memory access in utf_head_off
Bram Moolenaar <Bram@vim.org>
parents:
25118
diff
changeset
|
1340 exe "%norm e3\<c-v>kr\t" |
203b0f3a741a
patch 8.2.3494: illegal memory access in utf_head_off
Bram Moolenaar <Bram@vim.org>
parents:
25118
diff
changeset
|
1341 : |
203b0f3a741a
patch 8.2.3494: illegal memory access in utf_head_off
Bram Moolenaar <Bram@vim.org>
parents:
25118
diff
changeset
|
1342 |
203b0f3a741a
patch 8.2.3494: illegal memory access in utf_head_off
Bram Moolenaar <Bram@vim.org>
parents:
25118
diff
changeset
|
1343 : |
203b0f3a741a
patch 8.2.3494: illegal memory access in utf_head_off
Bram Moolenaar <Bram@vim.org>
parents:
25118
diff
changeset
|
1344 END |
30867
0913cd44fdfa
patch 9.0.0768: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30861
diff
changeset
|
1345 call writefile(lines, 'XvisualReselect', 'D') |
25921
203b0f3a741a
patch 8.2.3494: illegal memory access in utf_head_off
Bram Moolenaar <Bram@vim.org>
parents:
25118
diff
changeset
|
1346 source XvisualReselect |
203b0f3a741a
patch 8.2.3494: illegal memory access in utf_head_off
Bram Moolenaar <Bram@vim.org>
parents:
25118
diff
changeset
|
1347 |
203b0f3a741a
patch 8.2.3494: illegal memory access in utf_head_off
Bram Moolenaar <Bram@vim.org>
parents:
25118
diff
changeset
|
1348 bwipe! |
203b0f3a741a
patch 8.2.3494: illegal memory access in utf_head_off
Bram Moolenaar <Bram@vim.org>
parents:
25118
diff
changeset
|
1349 endfunc |
203b0f3a741a
patch 8.2.3494: illegal memory access in utf_head_off
Bram Moolenaar <Bram@vim.org>
parents:
25118
diff
changeset
|
1350 |
31680
24d9c23bf665
patch 9.0.1172: when 'selection' is "exclusive" then "1v" is one char short
Bram Moolenaar <Bram@vim.org>
parents:
30986
diff
changeset
|
1351 func Test_visual_reselect_exclusive() |
24d9c23bf665
patch 9.0.1172: when 'selection' is "exclusive" then "1v" is one char short
Bram Moolenaar <Bram@vim.org>
parents:
30986
diff
changeset
|
1352 new |
24d9c23bf665
patch 9.0.1172: when 'selection' is "exclusive" then "1v" is one char short
Bram Moolenaar <Bram@vim.org>
parents:
30986
diff
changeset
|
1353 call setline(1, ['abcde', 'abcde']) |
24d9c23bf665
patch 9.0.1172: when 'selection' is "exclusive" then "1v" is one char short
Bram Moolenaar <Bram@vim.org>
parents:
30986
diff
changeset
|
1354 set selection=exclusive |
24d9c23bf665
patch 9.0.1172: when 'selection' is "exclusive" then "1v" is one char short
Bram Moolenaar <Bram@vim.org>
parents:
30986
diff
changeset
|
1355 normal 1G0viwd |
24d9c23bf665
patch 9.0.1172: when 'selection' is "exclusive" then "1v" is one char short
Bram Moolenaar <Bram@vim.org>
parents:
30986
diff
changeset
|
1356 normal 2G01vd |
24d9c23bf665
patch 9.0.1172: when 'selection' is "exclusive" then "1v" is one char short
Bram Moolenaar <Bram@vim.org>
parents:
30986
diff
changeset
|
1357 call assert_equal(['', ''], getline(1, 2)) |
24d9c23bf665
patch 9.0.1172: when 'selection' is "exclusive" then "1v" is one char short
Bram Moolenaar <Bram@vim.org>
parents:
30986
diff
changeset
|
1358 |
24d9c23bf665
patch 9.0.1172: when 'selection' is "exclusive" then "1v" is one char short
Bram Moolenaar <Bram@vim.org>
parents:
30986
diff
changeset
|
1359 set selection& |
24d9c23bf665
patch 9.0.1172: when 'selection' is "exclusive" then "1v" is one char short
Bram Moolenaar <Bram@vim.org>
parents:
30986
diff
changeset
|
1360 bwipe! |
24d9c23bf665
patch 9.0.1172: when 'selection' is "exclusive" then "1v" is one char short
Bram Moolenaar <Bram@vim.org>
parents:
30986
diff
changeset
|
1361 endfunc |
24d9c23bf665
patch 9.0.1172: when 'selection' is "exclusive" then "1v" is one char short
Bram Moolenaar <Bram@vim.org>
parents:
30986
diff
changeset
|
1362 |
27245
776db9e02b61
patch 8.2.4151: reading beyond the end of a line
Bram Moolenaar <Bram@vim.org>
parents:
27185
diff
changeset
|
1363 func Test_visual_block_insert_round_off() |
776db9e02b61
patch 8.2.4151: reading beyond the end of a line
Bram Moolenaar <Bram@vim.org>
parents:
27185
diff
changeset
|
1364 new |
776db9e02b61
patch 8.2.4151: reading beyond the end of a line
Bram Moolenaar <Bram@vim.org>
parents:
27185
diff
changeset
|
1365 " The number of characters are tuned to fill a 4096 byte allocated block, |
776db9e02b61
patch 8.2.4151: reading beyond the end of a line
Bram Moolenaar <Bram@vim.org>
parents:
27185
diff
changeset
|
1366 " so that valgrind reports going over the end. |
776db9e02b61
patch 8.2.4151: reading beyond the end of a line
Bram Moolenaar <Bram@vim.org>
parents:
27185
diff
changeset
|
1367 call setline(1, ['xxxxx', repeat('0', 1350), "\t", repeat('x', 60)]) |
776db9e02b61
patch 8.2.4151: reading beyond the end of a line
Bram Moolenaar <Bram@vim.org>
parents:
27185
diff
changeset
|
1368 exe "normal gg0\<C-V>GI" .. repeat('0', 1320) .. "\<Esc>" |
776db9e02b61
patch 8.2.4151: reading beyond the end of a line
Bram Moolenaar <Bram@vim.org>
parents:
27185
diff
changeset
|
1369 bwipe! |
776db9e02b61
patch 8.2.4151: reading beyond the end of a line
Bram Moolenaar <Bram@vim.org>
parents:
27185
diff
changeset
|
1370 endfunc |
776db9e02b61
patch 8.2.4151: reading beyond the end of a line
Bram Moolenaar <Bram@vim.org>
parents:
27185
diff
changeset
|
1371 |
27251
85f56e16da9b
patch 8.2.4154: ml_get error when exchanging windows in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
27245
diff
changeset
|
1372 " this was causing an ml_get error |
85f56e16da9b
patch 8.2.4154: ml_get error when exchanging windows in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
27245
diff
changeset
|
1373 func Test_visual_exchange_windows() |
85f56e16da9b
patch 8.2.4154: ml_get error when exchanging windows in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
27245
diff
changeset
|
1374 enew! |
85f56e16da9b
patch 8.2.4154: ml_get error when exchanging windows in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
27245
diff
changeset
|
1375 new |
85f56e16da9b
patch 8.2.4154: ml_get error when exchanging windows in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
27245
diff
changeset
|
1376 call setline(1, ['foo', 'bar']) |
85f56e16da9b
patch 8.2.4154: ml_get error when exchanging windows in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
27245
diff
changeset
|
1377 exe "normal G\<C-V>gg\<C-W>\<C-X>OO\<Esc>" |
85f56e16da9b
patch 8.2.4154: ml_get error when exchanging windows in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
27245
diff
changeset
|
1378 bwipe! |
85f56e16da9b
patch 8.2.4154: ml_get error when exchanging windows in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
27245
diff
changeset
|
1379 bwipe! |
85f56e16da9b
patch 8.2.4154: ml_get error when exchanging windows in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
27245
diff
changeset
|
1380 endfunc |
85f56e16da9b
patch 8.2.4154: ml_get error when exchanging windows in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
27245
diff
changeset
|
1381 |
27374
c9a6c79998b2
patch 8.2.4215: illegal memory access when copying lines in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
27251
diff
changeset
|
1382 " this was leaving the end of the Visual area beyond the end of a line |
c9a6c79998b2
patch 8.2.4215: illegal memory access when copying lines in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
27251
diff
changeset
|
1383 func Test_visual_ex_copy_line() |
c9a6c79998b2
patch 8.2.4215: illegal memory access when copying lines in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
27251
diff
changeset
|
1384 new |
c9a6c79998b2
patch 8.2.4215: illegal memory access when copying lines in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
27251
diff
changeset
|
1385 call setline(1, ["aaa", "bbbbbbbbbxbb"]) |
c9a6c79998b2
patch 8.2.4215: illegal memory access when copying lines in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
27251
diff
changeset
|
1386 /x |
c9a6c79998b2
patch 8.2.4215: illegal memory access when copying lines in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
27251
diff
changeset
|
1387 exe "normal ggvjfxO" |
c9a6c79998b2
patch 8.2.4215: illegal memory access when copying lines in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
27251
diff
changeset
|
1388 t0 |
c9a6c79998b2
patch 8.2.4215: illegal memory access when copying lines in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
27251
diff
changeset
|
1389 normal gNU |
c9a6c79998b2
patch 8.2.4215: illegal memory access when copying lines in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
27251
diff
changeset
|
1390 bwipe! |
c9a6c79998b2
patch 8.2.4215: illegal memory access when copying lines in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
27251
diff
changeset
|
1391 endfunc |
c9a6c79998b2
patch 8.2.4215: illegal memory access when copying lines in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
27251
diff
changeset
|
1392 |
27378
a4746d1a3cf3
patch 8.2.4217: illegal memory access when undo makes Visual area invalid
Bram Moolenaar <Bram@vim.org>
parents:
27374
diff
changeset
|
1393 " This was leaving the end of the Visual area beyond the end of a line. |
a4746d1a3cf3
patch 8.2.4217: illegal memory access when undo makes Visual area invalid
Bram Moolenaar <Bram@vim.org>
parents:
27374
diff
changeset
|
1394 " Set 'undolevels' to start a new undo block. |
a4746d1a3cf3
patch 8.2.4217: illegal memory access when undo makes Visual area invalid
Bram Moolenaar <Bram@vim.org>
parents:
27374
diff
changeset
|
1395 func Test_visual_undo_deletes_last_line() |
a4746d1a3cf3
patch 8.2.4217: illegal memory access when undo makes Visual area invalid
Bram Moolenaar <Bram@vim.org>
parents:
27374
diff
changeset
|
1396 new |
a4746d1a3cf3
patch 8.2.4217: illegal memory access when undo makes Visual area invalid
Bram Moolenaar <Bram@vim.org>
parents:
27374
diff
changeset
|
1397 call setline(1, ["aaa", "ccc", "dyd"]) |
a4746d1a3cf3
patch 8.2.4217: illegal memory access when undo makes Visual area invalid
Bram Moolenaar <Bram@vim.org>
parents:
27374
diff
changeset
|
1398 set undolevels=100 |
a4746d1a3cf3
patch 8.2.4217: illegal memory access when undo makes Visual area invalid
Bram Moolenaar <Bram@vim.org>
parents:
27374
diff
changeset
|
1399 exe "normal obbbbbbbbbxbb\<Esc>" |
a4746d1a3cf3
patch 8.2.4217: illegal memory access when undo makes Visual area invalid
Bram Moolenaar <Bram@vim.org>
parents:
27374
diff
changeset
|
1400 set undolevels=100 |
a4746d1a3cf3
patch 8.2.4217: illegal memory access when undo makes Visual area invalid
Bram Moolenaar <Bram@vim.org>
parents:
27374
diff
changeset
|
1401 /y |
a4746d1a3cf3
patch 8.2.4217: illegal memory access when undo makes Visual area invalid
Bram Moolenaar <Bram@vim.org>
parents:
27374
diff
changeset
|
1402 exe "normal ggvjfxO" |
a4746d1a3cf3
patch 8.2.4217: illegal memory access when undo makes Visual area invalid
Bram Moolenaar <Bram@vim.org>
parents:
27374
diff
changeset
|
1403 undo |
a4746d1a3cf3
patch 8.2.4217: illegal memory access when undo makes Visual area invalid
Bram Moolenaar <Bram@vim.org>
parents:
27374
diff
changeset
|
1404 normal gNU |
27428
3f8a57b8c7d8
patch 8.2.4242: put in Visual mode cannot be repeated
Bram Moolenaar <Bram@vim.org>
parents:
27382
diff
changeset
|
1405 |
27378
a4746d1a3cf3
patch 8.2.4217: illegal memory access when undo makes Visual area invalid
Bram Moolenaar <Bram@vim.org>
parents:
27374
diff
changeset
|
1406 bwipe! |
a4746d1a3cf3
patch 8.2.4217: illegal memory access when undo makes Visual area invalid
Bram Moolenaar <Bram@vim.org>
parents:
27374
diff
changeset
|
1407 endfunc |
a4746d1a3cf3
patch 8.2.4217: illegal memory access when undo makes Visual area invalid
Bram Moolenaar <Bram@vim.org>
parents:
27374
diff
changeset
|
1408 |
27428
3f8a57b8c7d8
patch 8.2.4242: put in Visual mode cannot be repeated
Bram Moolenaar <Bram@vim.org>
parents:
27382
diff
changeset
|
1409 func Test_visual_paste() |
3f8a57b8c7d8
patch 8.2.4242: put in Visual mode cannot be repeated
Bram Moolenaar <Bram@vim.org>
parents:
27382
diff
changeset
|
1410 new |
3f8a57b8c7d8
patch 8.2.4242: put in Visual mode cannot be repeated
Bram Moolenaar <Bram@vim.org>
parents:
27382
diff
changeset
|
1411 |
3f8a57b8c7d8
patch 8.2.4242: put in Visual mode cannot be repeated
Bram Moolenaar <Bram@vim.org>
parents:
27382
diff
changeset
|
1412 " v_p overwrites unnamed register. |
3f8a57b8c7d8
patch 8.2.4242: put in Visual mode cannot be repeated
Bram Moolenaar <Bram@vim.org>
parents:
27382
diff
changeset
|
1413 call setline(1, ['xxxx']) |
3f8a57b8c7d8
patch 8.2.4242: put in Visual mode cannot be repeated
Bram Moolenaar <Bram@vim.org>
parents:
27382
diff
changeset
|
1414 call setreg('"', 'foo') |
3f8a57b8c7d8
patch 8.2.4242: put in Visual mode cannot be repeated
Bram Moolenaar <Bram@vim.org>
parents:
27382
diff
changeset
|
1415 call setreg('-', 'bar') |
27577
40d844af56a5
patch 8.2.4315: put in Visual mode not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
27428
diff
changeset
|
1416 normal gg0vp |
40d844af56a5
patch 8.2.4315: put in Visual mode not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
27428
diff
changeset
|
1417 call assert_equal('x', @") |
40d844af56a5
patch 8.2.4315: put in Visual mode not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
27428
diff
changeset
|
1418 call assert_equal('x', @-) |
40d844af56a5
patch 8.2.4315: put in Visual mode not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
27428
diff
changeset
|
1419 call assert_equal('fooxxx', getline(1)) |
40d844af56a5
patch 8.2.4315: put in Visual mode not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
27428
diff
changeset
|
1420 normal $vp |
40d844af56a5
patch 8.2.4315: put in Visual mode not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
27428
diff
changeset
|
1421 call assert_equal('x', @") |
40d844af56a5
patch 8.2.4315: put in Visual mode not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
27428
diff
changeset
|
1422 call assert_equal('x', @-) |
40d844af56a5
patch 8.2.4315: put in Visual mode not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
27428
diff
changeset
|
1423 call assert_equal('fooxxx', getline(1)) |
40d844af56a5
patch 8.2.4315: put in Visual mode not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
27428
diff
changeset
|
1424 " Test with a different register as unnamed register. |
40d844af56a5
patch 8.2.4315: put in Visual mode not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
27428
diff
changeset
|
1425 call setline(2, ['baz']) |
40d844af56a5
patch 8.2.4315: put in Visual mode not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
27428
diff
changeset
|
1426 normal 2gg0"rD |
40d844af56a5
patch 8.2.4315: put in Visual mode not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
27428
diff
changeset
|
1427 call assert_equal('baz', @") |
40d844af56a5
patch 8.2.4315: put in Visual mode not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
27428
diff
changeset
|
1428 normal gg0vp |
40d844af56a5
patch 8.2.4315: put in Visual mode not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
27428
diff
changeset
|
1429 call assert_equal('f', @") |
40d844af56a5
patch 8.2.4315: put in Visual mode not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
27428
diff
changeset
|
1430 call assert_equal('f', @-) |
40d844af56a5
patch 8.2.4315: put in Visual mode not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
27428
diff
changeset
|
1431 call assert_equal('bazooxxx', getline(1)) |
40d844af56a5
patch 8.2.4315: put in Visual mode not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
27428
diff
changeset
|
1432 normal $vp |
40d844af56a5
patch 8.2.4315: put in Visual mode not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
27428
diff
changeset
|
1433 call assert_equal('x', @") |
40d844af56a5
patch 8.2.4315: put in Visual mode not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
27428
diff
changeset
|
1434 call assert_equal('x', @-) |
40d844af56a5
patch 8.2.4315: put in Visual mode not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
27428
diff
changeset
|
1435 call assert_equal('bazooxxf', getline(1)) |
27428
3f8a57b8c7d8
patch 8.2.4242: put in Visual mode cannot be repeated
Bram Moolenaar <Bram@vim.org>
parents:
27382
diff
changeset
|
1436 |
28714
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1437 bwipe! |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1438 endfunc |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1439 |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1440 func Test_visual_paste_clipboard() |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1441 CheckFeature clipboard_working |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1442 |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1443 if has('gui') |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1444 " auto select feature breaks tests |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1445 set guioptions-=a |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1446 endif |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1447 |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1448 " v_P does not overwrite unnamed register. |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1449 call setline(1, ['xxxx']) |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1450 call setreg('"', 'foo') |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1451 call setreg('-', 'bar') |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1452 normal gg0vP |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1453 call assert_equal('foo', @") |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1454 call assert_equal('bar', @-) |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1455 call assert_equal('fooxxx', getline(1)) |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1456 normal $vP |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1457 call assert_equal('foo', @") |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1458 call assert_equal('bar', @-) |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1459 call assert_equal('fooxxfoo', getline(1)) |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1460 " Test with a different register as unnamed register. |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1461 call setline(2, ['baz']) |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1462 normal 2gg0"rD |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1463 call assert_equal('baz', @") |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1464 normal gg0vP |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1465 call assert_equal('baz', @") |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1466 call assert_equal('bar', @-) |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1467 call assert_equal('bazooxxfoo', getline(1)) |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1468 normal $vP |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1469 call assert_equal('baz', @") |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1470 call assert_equal('bar', @-) |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1471 call assert_equal('bazooxxfobaz', getline(1)) |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1472 |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1473 " Test for unnamed clipboard |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1474 set clipboard=unnamed |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1475 call setline(1, ['xxxx']) |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1476 call setreg('"', 'foo') |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1477 call setreg('-', 'bar') |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1478 call setreg('*', 'baz') |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1479 normal gg0vP |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1480 call assert_equal('foo', @") |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1481 call assert_equal('bar', @-) |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1482 call assert_equal('baz', @*) |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1483 call assert_equal('bazxxx', getline(1)) |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1484 |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1485 " Test for unnamedplus clipboard |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1486 if has('unnamedplus') |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1487 set clipboard=unnamedplus |
27428
3f8a57b8c7d8
patch 8.2.4242: put in Visual mode cannot be repeated
Bram Moolenaar <Bram@vim.org>
parents:
27382
diff
changeset
|
1488 call setline(1, ['xxxx']) |
3f8a57b8c7d8
patch 8.2.4242: put in Visual mode cannot be repeated
Bram Moolenaar <Bram@vim.org>
parents:
27382
diff
changeset
|
1489 call setreg('"', 'foo') |
3f8a57b8c7d8
patch 8.2.4242: put in Visual mode cannot be repeated
Bram Moolenaar <Bram@vim.org>
parents:
27382
diff
changeset
|
1490 call setreg('-', 'bar') |
28714
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1491 call setreg('+', 'baz') |
27577
40d844af56a5
patch 8.2.4315: put in Visual mode not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
27428
diff
changeset
|
1492 normal gg0vP |
40d844af56a5
patch 8.2.4315: put in Visual mode not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
27428
diff
changeset
|
1493 call assert_equal('foo', @") |
28714
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1494 call assert_equal('bar', @-) |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1495 call assert_equal('baz', @+) |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1496 call assert_equal('bazxxx', getline(1)) |
27428
3f8a57b8c7d8
patch 8.2.4242: put in Visual mode cannot be repeated
Bram Moolenaar <Bram@vim.org>
parents:
27382
diff
changeset
|
1497 endif |
3f8a57b8c7d8
patch 8.2.4242: put in Visual mode cannot be repeated
Bram Moolenaar <Bram@vim.org>
parents:
27382
diff
changeset
|
1498 |
28714
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1499 set clipboard& |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1500 if has('gui') |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1501 set guioptions& |
5eea8a249f86
patch 8.2.4881: "P" in Visual mode still changes some registers
Bram Moolenaar <Bram@vim.org>
parents:
27577
diff
changeset
|
1502 endif |
27428
3f8a57b8c7d8
patch 8.2.4242: put in Visual mode cannot be repeated
Bram Moolenaar <Bram@vim.org>
parents:
27382
diff
changeset
|
1503 bwipe! |
3f8a57b8c7d8
patch 8.2.4242: put in Visual mode cannot be repeated
Bram Moolenaar <Bram@vim.org>
parents:
27382
diff
changeset
|
1504 endfunc |
24866
f1121eb17e14
patch 8.2.2971: cannot yank a block without trailing spaces
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
1505 |
29348
05ac4ab2c282
patch 9.0.0017: accessing memory beyond the end of the line
Bram Moolenaar <Bram@vim.org>
parents:
28893
diff
changeset
|
1506 func Test_visual_area_adjusted_when_hiding() |
05ac4ab2c282
patch 9.0.0017: accessing memory beyond the end of the line
Bram Moolenaar <Bram@vim.org>
parents:
28893
diff
changeset
|
1507 " The Visual area ended after the end of the line after :hide |
05ac4ab2c282
patch 9.0.0017: accessing memory beyond the end of the line
Bram Moolenaar <Bram@vim.org>
parents:
28893
diff
changeset
|
1508 call setline(1, 'xxx') |
30051
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
29716
diff
changeset
|
1509 vsplit Xvaafile |
29348
05ac4ab2c282
patch 9.0.0017: accessing memory beyond the end of the line
Bram Moolenaar <Bram@vim.org>
parents:
28893
diff
changeset
|
1510 call setline(1, 'xxxxxxxx') |
05ac4ab2c282
patch 9.0.0017: accessing memory beyond the end of the line
Bram Moolenaar <Bram@vim.org>
parents:
28893
diff
changeset
|
1511 norm! $o |
05ac4ab2c282
patch 9.0.0017: accessing memory beyond the end of the line
Bram Moolenaar <Bram@vim.org>
parents:
28893
diff
changeset
|
1512 hid |
05ac4ab2c282
patch 9.0.0017: accessing memory beyond the end of the line
Bram Moolenaar <Bram@vim.org>
parents:
28893
diff
changeset
|
1513 norm! zW |
05ac4ab2c282
patch 9.0.0017: accessing memory beyond the end of the line
Bram Moolenaar <Bram@vim.org>
parents:
28893
diff
changeset
|
1514 bwipe! |
05ac4ab2c282
patch 9.0.0017: accessing memory beyond the end of the line
Bram Moolenaar <Bram@vim.org>
parents:
28893
diff
changeset
|
1515 bwipe! |
05ac4ab2c282
patch 9.0.0017: accessing memory beyond the end of the line
Bram Moolenaar <Bram@vim.org>
parents:
28893
diff
changeset
|
1516 endfunc |
05ac4ab2c282
patch 9.0.0017: accessing memory beyond the end of the line
Bram Moolenaar <Bram@vim.org>
parents:
28893
diff
changeset
|
1517 |
29716
c8c128b0eddc
patch 9.0.0198: ml_get error when switching buffer in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
29348
diff
changeset
|
1518 func Test_switch_buffer_ends_visual_mode() |
c8c128b0eddc
patch 9.0.0198: ml_get error when switching buffer in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
29348
diff
changeset
|
1519 enew |
c8c128b0eddc
patch 9.0.0198: ml_get error when switching buffer in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
29348
diff
changeset
|
1520 call setline(1, 'foo') |
c8c128b0eddc
patch 9.0.0198: ml_get error when switching buffer in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
29348
diff
changeset
|
1521 set hidden |
c8c128b0eddc
patch 9.0.0198: ml_get error when switching buffer in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
29348
diff
changeset
|
1522 set virtualedit=all |
c8c128b0eddc
patch 9.0.0198: ml_get error when switching buffer in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
29348
diff
changeset
|
1523 let buf1 = bufnr() |
c8c128b0eddc
patch 9.0.0198: ml_get error when switching buffer in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
29348
diff
changeset
|
1524 enew |
c8c128b0eddc
patch 9.0.0198: ml_get error when switching buffer in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
29348
diff
changeset
|
1525 let buf2 = bufnr() |
c8c128b0eddc
patch 9.0.0198: ml_get error when switching buffer in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
29348
diff
changeset
|
1526 call setline(1, ['', '', '', '']) |
c8c128b0eddc
patch 9.0.0198: ml_get error when switching buffer in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
29348
diff
changeset
|
1527 call cursor(4, 5) |
c8c128b0eddc
patch 9.0.0198: ml_get error when switching buffer in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
29348
diff
changeset
|
1528 call feedkeys("\<C-V>3k4h", 'xt') |
c8c128b0eddc
patch 9.0.0198: ml_get error when switching buffer in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
29348
diff
changeset
|
1529 exe 'buffer' buf1 |
c8c128b0eddc
patch 9.0.0198: ml_get error when switching buffer in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
29348
diff
changeset
|
1530 call assert_equal('n', mode()) |
c8c128b0eddc
patch 9.0.0198: ml_get error when switching buffer in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
29348
diff
changeset
|
1531 |
c8c128b0eddc
patch 9.0.0198: ml_get error when switching buffer in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
29348
diff
changeset
|
1532 set nohidden |
c8c128b0eddc
patch 9.0.0198: ml_get error when switching buffer in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
29348
diff
changeset
|
1533 set virtualedit= |
c8c128b0eddc
patch 9.0.0198: ml_get error when switching buffer in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
29348
diff
changeset
|
1534 bwipe! |
c8c128b0eddc
patch 9.0.0198: ml_get error when switching buffer in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
29348
diff
changeset
|
1535 exe 'bwipe!' buf2 |
c8c128b0eddc
patch 9.0.0198: ml_get error when switching buffer in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
29348
diff
changeset
|
1536 endfunc |
c8c128b0eddc
patch 9.0.0198: ml_get error when switching buffer in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
29348
diff
changeset
|
1537 |
31998
bb31c1c6d1ad
patch 9.0.1331: illegal memory access when using :ball in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
31881
diff
changeset
|
1538 " Check fix for the heap-based buffer overflow bug found in the function |
bb31c1c6d1ad
patch 9.0.1331: illegal memory access when using :ball in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
31881
diff
changeset
|
1539 " utfc_ptr2len and reported at |
bb31c1c6d1ad
patch 9.0.1331: illegal memory access when using :ball in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
31881
diff
changeset
|
1540 " https://huntr.dev/bounties/ae933869-a1ec-402a-bbea-d51764c6618e |
bb31c1c6d1ad
patch 9.0.1331: illegal memory access when using :ball in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
31881
diff
changeset
|
1541 func Test_heap_buffer_overflow() |
bb31c1c6d1ad
patch 9.0.1331: illegal memory access when using :ball in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
31881
diff
changeset
|
1542 enew |
bb31c1c6d1ad
patch 9.0.1331: illegal memory access when using :ball in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
31881
diff
changeset
|
1543 set updatecount=0 |
bb31c1c6d1ad
patch 9.0.1331: illegal memory access when using :ball in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
31881
diff
changeset
|
1544 |
bb31c1c6d1ad
patch 9.0.1331: illegal memory access when using :ball in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
31881
diff
changeset
|
1545 norm R0 |
bb31c1c6d1ad
patch 9.0.1331: illegal memory access when using :ball in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
31881
diff
changeset
|
1546 split other |
bb31c1c6d1ad
patch 9.0.1331: illegal memory access when using :ball in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
31881
diff
changeset
|
1547 norm R000 |
bb31c1c6d1ad
patch 9.0.1331: illegal memory access when using :ball in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
31881
diff
changeset
|
1548 exe "norm \<C-V>l" |
bb31c1c6d1ad
patch 9.0.1331: illegal memory access when using :ball in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
31881
diff
changeset
|
1549 ball |
bb31c1c6d1ad
patch 9.0.1331: illegal memory access when using :ball in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
31881
diff
changeset
|
1550 call assert_equal(getpos("."), getpos("v")) |
bb31c1c6d1ad
patch 9.0.1331: illegal memory access when using :ball in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
31881
diff
changeset
|
1551 call assert_equal('n', mode()) |
bb31c1c6d1ad
patch 9.0.1331: illegal memory access when using :ball in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
31881
diff
changeset
|
1552 norm zW |
bb31c1c6d1ad
patch 9.0.1331: illegal memory access when using :ball in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
31881
diff
changeset
|
1553 |
bb31c1c6d1ad
patch 9.0.1331: illegal memory access when using :ball in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
31881
diff
changeset
|
1554 %bwipe! |
bb31c1c6d1ad
patch 9.0.1331: illegal memory access when using :ball in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
31881
diff
changeset
|
1555 set updatecount& |
bb31c1c6d1ad
patch 9.0.1331: illegal memory access when using :ball in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
31881
diff
changeset
|
1556 endfunc |
bb31c1c6d1ad
patch 9.0.1331: illegal memory access when using :ball in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
31881
diff
changeset
|
1557 |
32900
8325b9a4c732
patch 9.0.1759: Visual highlight not working with cursor at end of screen line
Christian Brabandt <cb@256bit.org>
parents:
31998
diff
changeset
|
1558 " Test Visual highlight with cursor at end of screen line and 'showbreak' |
8325b9a4c732
patch 9.0.1759: Visual highlight not working with cursor at end of screen line
Christian Brabandt <cb@256bit.org>
parents:
31998
diff
changeset
|
1559 func Test_visual_hl_with_showbreak() |
8325b9a4c732
patch 9.0.1759: Visual highlight not working with cursor at end of screen line
Christian Brabandt <cb@256bit.org>
parents:
31998
diff
changeset
|
1560 CheckScreendump |
8325b9a4c732
patch 9.0.1759: Visual highlight not working with cursor at end of screen line
Christian Brabandt <cb@256bit.org>
parents:
31998
diff
changeset
|
1561 |
8325b9a4c732
patch 9.0.1759: Visual highlight not working with cursor at end of screen line
Christian Brabandt <cb@256bit.org>
parents:
31998
diff
changeset
|
1562 let lines =<< trim END |
8325b9a4c732
patch 9.0.1759: Visual highlight not working with cursor at end of screen line
Christian Brabandt <cb@256bit.org>
parents:
31998
diff
changeset
|
1563 setlocal showbreak=+ |
8325b9a4c732
patch 9.0.1759: Visual highlight not working with cursor at end of screen line
Christian Brabandt <cb@256bit.org>
parents:
31998
diff
changeset
|
1564 call setline(1, repeat('a', &columns + 10)) |
8325b9a4c732
patch 9.0.1759: Visual highlight not working with cursor at end of screen line
Christian Brabandt <cb@256bit.org>
parents:
31998
diff
changeset
|
1565 normal g$v4lo |
8325b9a4c732
patch 9.0.1759: Visual highlight not working with cursor at end of screen line
Christian Brabandt <cb@256bit.org>
parents:
31998
diff
changeset
|
1566 END |
8325b9a4c732
patch 9.0.1759: Visual highlight not working with cursor at end of screen line
Christian Brabandt <cb@256bit.org>
parents:
31998
diff
changeset
|
1567 call writefile(lines, 'XTest_visual_sbr', 'D') |
8325b9a4c732
patch 9.0.1759: Visual highlight not working with cursor at end of screen line
Christian Brabandt <cb@256bit.org>
parents:
31998
diff
changeset
|
1568 |
8325b9a4c732
patch 9.0.1759: Visual highlight not working with cursor at end of screen line
Christian Brabandt <cb@256bit.org>
parents:
31998
diff
changeset
|
1569 let buf = RunVimInTerminal('-S XTest_visual_sbr', {'rows': 6, 'cols': 50}) |
8325b9a4c732
patch 9.0.1759: Visual highlight not working with cursor at end of screen line
Christian Brabandt <cb@256bit.org>
parents:
31998
diff
changeset
|
1570 call VerifyScreenDump(buf, 'Test_visual_hl_with_showbreak', {}) |
8325b9a4c732
patch 9.0.1759: Visual highlight not working with cursor at end of screen line
Christian Brabandt <cb@256bit.org>
parents:
31998
diff
changeset
|
1571 |
8325b9a4c732
patch 9.0.1759: Visual highlight not working with cursor at end of screen line
Christian Brabandt <cb@256bit.org>
parents:
31998
diff
changeset
|
1572 " clean up |
8325b9a4c732
patch 9.0.1759: Visual highlight not working with cursor at end of screen line
Christian Brabandt <cb@256bit.org>
parents:
31998
diff
changeset
|
1573 call term_sendkeys(buf, "\<Esc>") |
8325b9a4c732
patch 9.0.1759: Visual highlight not working with cursor at end of screen line
Christian Brabandt <cb@256bit.org>
parents:
31998
diff
changeset
|
1574 call StopVimInTerminal(buf) |
8325b9a4c732
patch 9.0.1759: Visual highlight not working with cursor at end of screen line
Christian Brabandt <cb@256bit.org>
parents:
31998
diff
changeset
|
1575 endfunc |
31998
bb31c1c6d1ad
patch 9.0.1331: illegal memory access when using :ball in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
31881
diff
changeset
|
1576 |
33299
4c975fa0a442
patch 9.0.1915: r_CTRL-C works differently in visual mode
Christian Brabandt <cb@256bit.org>
parents:
32900
diff
changeset
|
1577 func Test_Visual_r_CTRL_C() |
4c975fa0a442
patch 9.0.1915: r_CTRL-C works differently in visual mode
Christian Brabandt <cb@256bit.org>
parents:
32900
diff
changeset
|
1578 new |
4c975fa0a442
patch 9.0.1915: r_CTRL-C works differently in visual mode
Christian Brabandt <cb@256bit.org>
parents:
32900
diff
changeset
|
1579 " visual r_cmd |
4c975fa0a442
patch 9.0.1915: r_CTRL-C works differently in visual mode
Christian Brabandt <cb@256bit.org>
parents:
32900
diff
changeset
|
1580 call setline(1, [' ']) |
4c975fa0a442
patch 9.0.1915: r_CTRL-C works differently in visual mode
Christian Brabandt <cb@256bit.org>
parents:
32900
diff
changeset
|
1581 call feedkeys("\<c-v>$r\<c-c>", 'tx') |
4c975fa0a442
patch 9.0.1915: r_CTRL-C works differently in visual mode
Christian Brabandt <cb@256bit.org>
parents:
32900
diff
changeset
|
1582 call assert_equal([''], getline(1, 1)) |
4c975fa0a442
patch 9.0.1915: r_CTRL-C works differently in visual mode
Christian Brabandt <cb@256bit.org>
parents:
32900
diff
changeset
|
1583 |
4c975fa0a442
patch 9.0.1915: r_CTRL-C works differently in visual mode
Christian Brabandt <cb@256bit.org>
parents:
32900
diff
changeset
|
1584 " visual gr_cmd |
4c975fa0a442
patch 9.0.1915: r_CTRL-C works differently in visual mode
Christian Brabandt <cb@256bit.org>
parents:
32900
diff
changeset
|
1585 call setline(1, [' ']) |
4c975fa0a442
patch 9.0.1915: r_CTRL-C works differently in visual mode
Christian Brabandt <cb@256bit.org>
parents:
32900
diff
changeset
|
1586 call feedkeys("\<c-v>$gr\<c-c>", 'tx') |
4c975fa0a442
patch 9.0.1915: r_CTRL-C works differently in visual mode
Christian Brabandt <cb@256bit.org>
parents:
32900
diff
changeset
|
1587 call assert_equal([''], getline(1, 1)) |
4c975fa0a442
patch 9.0.1915: r_CTRL-C works differently in visual mode
Christian Brabandt <cb@256bit.org>
parents:
32900
diff
changeset
|
1588 bw! |
33982
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1589 endfunc |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1590 |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1591 func Test_visual_drag_out_of_window() |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1592 rightbelow vnew |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1593 call setline(1, '123456789') |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1594 set mouse=a |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1595 func ClickExpr(off) |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1596 call test_setmouse(1, getwininfo(win_getid())[0].wincol + a:off) |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1597 return "\<LeftMouse>" |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1598 endfunc |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1599 func DragExpr(off) |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1600 call test_setmouse(1, getwininfo(win_getid())[0].wincol + a:off) |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1601 return "\<LeftDrag>" |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1602 endfunc |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1603 |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1604 nnoremap <expr> <F2> ClickExpr(5) |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1605 nnoremap <expr> <F3> DragExpr(-1) |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1606 redraw |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1607 call feedkeys("\<F2>\<F3>\<LeftRelease>", 'tx') |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1608 call assert_equal([1, 6], [col('.'), col('v')]) |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1609 call feedkeys("\<Esc>", 'tx') |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1610 |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1611 nnoremap <expr> <F2> ClickExpr(6) |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1612 nnoremap <expr> <F3> DragExpr(-2) |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1613 redraw |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1614 call feedkeys("\<F2>\<F3>\<LeftRelease>", 'tx') |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1615 call assert_equal([1, 7], [col('.'), col('v')]) |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1616 call feedkeys("\<Esc>", 'tx') |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1617 |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1618 nunmap <F2> |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1619 nunmap <F3> |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1620 delfunc ClickExpr |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1621 delfunc DragExpr |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1622 set mouse& |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1623 bwipe! |
63341afcd329
patch 9.0.2177: Wrong cursor position when dragging out of window
Christian Brabandt <cb@256bit.org>
parents:
33299
diff
changeset
|
1624 endfunc |
33299
4c975fa0a442
patch 9.0.1915: r_CTRL-C works differently in visual mode
Christian Brabandt <cb@256bit.org>
parents:
32900
diff
changeset
|
1625 |
34174
8b5471360746
patch 9.1.0043: ml_get: invalid lnum when :s replaces visual selection
Christian Brabandt <cb@256bit.org>
parents:
33982
diff
changeset
|
1626 func Test_visual_substitute_visual() |
8b5471360746
patch 9.1.0043: ml_get: invalid lnum when :s replaces visual selection
Christian Brabandt <cb@256bit.org>
parents:
33982
diff
changeset
|
1627 new |
8b5471360746
patch 9.1.0043: ml_get: invalid lnum when :s replaces visual selection
Christian Brabandt <cb@256bit.org>
parents:
33982
diff
changeset
|
1628 call setline(1, ['one', 'two', 'three']) |
8b5471360746
patch 9.1.0043: ml_get: invalid lnum when :s replaces visual selection
Christian Brabandt <cb@256bit.org>
parents:
33982
diff
changeset
|
1629 call feedkeys("Gk\<C-V>j$:s/\\%V\\_.*\\%V/foobar\<CR>", 'tx') |
8b5471360746
patch 9.1.0043: ml_get: invalid lnum when :s replaces visual selection
Christian Brabandt <cb@256bit.org>
parents:
33982
diff
changeset
|
1630 call assert_equal(['one', 'foobar'], getline(1, '$')) |
8b5471360746
patch 9.1.0043: ml_get: invalid lnum when :s replaces visual selection
Christian Brabandt <cb@256bit.org>
parents:
33982
diff
changeset
|
1631 bwipe! |
8b5471360746
patch 9.1.0043: ml_get: invalid lnum when :s replaces visual selection
Christian Brabandt <cb@256bit.org>
parents:
33982
diff
changeset
|
1632 endfunc |
8b5471360746
patch 9.1.0043: ml_get: invalid lnum when :s replaces visual selection
Christian Brabandt <cb@256bit.org>
parents:
33982
diff
changeset
|
1633 |
34387
e6defaa1e46a
patch 9.1.0120: hard to get visual region using Vim script
Christian Brabandt <cb@256bit.org>
parents:
34344
diff
changeset
|
1634 func Test_visual_getregion() |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1635 let lines =<< trim END |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1636 new |
34387
e6defaa1e46a
patch 9.1.0120: hard to get visual region using Vim script
Christian Brabandt <cb@256bit.org>
parents:
34344
diff
changeset
|
1637 |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1638 call setline(1, ['one', 'two', 'three']) |
34387
e6defaa1e46a
patch 9.1.0120: hard to get visual region using Vim script
Christian Brabandt <cb@256bit.org>
parents:
34344
diff
changeset
|
1639 |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1640 #" Visual mode |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1641 call cursor(1, 1) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1642 call feedkeys("\<ESC>vjl", 'tx') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1643 call assert_equal(['one', 'tw'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1644 \ 'v'->getpos()->getregion(getpos('.'))) |
35125
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1645 call assert_equal([ |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1646 \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 3, 0]], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1647 \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 2, 0]] |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1648 \ ], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1649 \ 'v'->getpos()->getregionpos(getpos('.'))) |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1650 call assert_equal(['one', 'tw'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1651 \ '.'->getpos()->getregion(getpos('v'))) |
35125
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1652 call assert_equal([ |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1653 \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 3, 0]], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1654 \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 2, 0]] |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1655 \ ], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1656 \ '.'->getpos()->getregionpos(getpos('v'))) |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1657 call assert_equal(['o'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1658 \ 'v'->getpos()->getregion(getpos('v'))) |
35125
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1659 call assert_equal([ |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1660 \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 1, 0]], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1661 \ ], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1662 \ 'v'->getpos()->getregionpos(getpos('v'))) |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1663 call assert_equal(['w'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1664 \ '.'->getpos()->getregion(getpos('.'), {'type': 'v' })) |
35125
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1665 call assert_equal([ |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1666 \ [[bufnr('%'), 2, 2, 0], [bufnr('%'), 2, 2, 0]], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1667 \ ], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1668 \ '.'->getpos()->getregionpos(getpos('.'), {'type': 'v' })) |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1669 call assert_equal(['one', 'two'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1670 \ getpos('.')->getregion(getpos('v'), {'type': 'V' })) |
35125
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1671 call assert_equal([ |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1672 \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 3, 0]], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1673 \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 3, 0]], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1674 \ ], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1675 \ getpos('.')->getregionpos(getpos('v'), {'type': 'V' })) |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1676 call assert_equal(['on', 'tw'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1677 \ getpos('.')->getregion(getpos('v'), {'type': "\<C-v>" })) |
35125
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1678 call assert_equal([ |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1679 \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 2, 0]], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1680 \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 2, 0]], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1681 \ ], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1682 \ getpos('.')->getregionpos(getpos('v'), {'type': "\<C-v>" })) |
34387
e6defaa1e46a
patch 9.1.0120: hard to get visual region using Vim script
Christian Brabandt <cb@256bit.org>
parents:
34344
diff
changeset
|
1683 |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1684 #" Line visual mode |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1685 call cursor(1, 1) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1686 call feedkeys("\<ESC>Vl", 'tx') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1687 call assert_equal(['one'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1688 \ getregion(getpos('v'), getpos('.'), {'type': 'V' })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1689 call assert_equal(['one'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1690 \ getregion(getpos('.'), getpos('v'), {'type': 'V' })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1691 call assert_equal(['one'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1692 \ getregion(getpos('v'), getpos('v'), {'type': 'V' })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1693 call assert_equal(['one'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1694 \ getregion(getpos('.'), getpos('.'), {'type': 'V' })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1695 call assert_equal(['on'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1696 \ getpos('.')->getregion(getpos('v'), {'type': 'v' })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1697 call assert_equal(['on'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1698 \ getpos('.')->getregion(getpos('v'), {'type': "\<C-v>" })) |
34387
e6defaa1e46a
patch 9.1.0120: hard to get visual region using Vim script
Christian Brabandt <cb@256bit.org>
parents:
34344
diff
changeset
|
1699 |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1700 #" Block visual mode |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1701 call cursor(1, 1) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1702 call feedkeys("\<ESC>\<C-v>ll", 'tx') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1703 call assert_equal(['one'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1704 \ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1705 call assert_equal(['one'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1706 \ getregion(getpos('.'), getpos('v'), {'type': "\<C-v>" })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1707 call assert_equal(['o'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1708 \ getregion(getpos('v'), getpos('v'), {'type': "\<C-v>" })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1709 call assert_equal(['e'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1710 \ getregion(getpos('.'), getpos('.'), {'type': "\<C-v>" })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1711 call assert_equal(['one'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1712 \ '.'->getpos()->getregion(getpos('v'), {'type': 'V' })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1713 call assert_equal(['one'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1714 \ '.'->getpos()->getregion(getpos('v'), {'type': 'v' })) |
34387
e6defaa1e46a
patch 9.1.0120: hard to get visual region using Vim script
Christian Brabandt <cb@256bit.org>
parents:
34344
diff
changeset
|
1715 |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1716 #" Using Marks |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1717 call setpos("'a", [0, 2, 3, 0]) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1718 call cursor(1, 1) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1719 call assert_equal(['one', 'two'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1720 \ "'a"->getpos()->getregion(getpos('.'), {'type': 'v' })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1721 call assert_equal(['one', 'two'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1722 \ "."->getpos()->getregion(getpos("'a"), {'type': 'v' })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1723 call assert_equal(['one', 'two'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1724 \ "."->getpos()->getregion(getpos("'a"), {'type': 'V' })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1725 call assert_equal(['two'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1726 \ "'a"->getpos()->getregion(getpos("'a"), {'type': 'V' })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1727 call assert_equal(['one', 'two'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1728 \ "."->getpos()->getregion(getpos("'a"), {'type': "\<c-v>" })) |
35097
c729852bfc19
patch 9.1.0388: cursor() and getregion() don't handle v:maxcol well
Christian Brabandt <cb@256bit.org>
parents:
34678
diff
changeset
|
1729 call feedkeys("\<ESC>jVj\<ESC>", 'tx') |
c729852bfc19
patch 9.1.0388: cursor() and getregion() don't handle v:maxcol well
Christian Brabandt <cb@256bit.org>
parents:
34678
diff
changeset
|
1730 call assert_equal(['two', 'three'], getregion(getpos("'<"), getpos("'>"))) |
c729852bfc19
patch 9.1.0388: cursor() and getregion() don't handle v:maxcol well
Christian Brabandt <cb@256bit.org>
parents:
34678
diff
changeset
|
1731 call assert_equal(['two', 'three'], getregion(getpos("'>"), getpos("'<"))) |
34387
e6defaa1e46a
patch 9.1.0120: hard to get visual region using Vim script
Christian Brabandt <cb@256bit.org>
parents:
34344
diff
changeset
|
1732 |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1733 #" Using List |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1734 call cursor(1, 1) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1735 call assert_equal(['one', 'two'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1736 \ [0, 2, 3, 0]->getregion(getpos('.'), {'type': 'v' })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1737 call assert_equal(['one', 'two'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1738 \ '.'->getpos()->getregion([0, 2, 3, 0], {'type': 'v' })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1739 call assert_equal(['one', 'two'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1740 \ '.'->getpos()->getregion([0, 2, 3, 0], {'type': 'V' })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1741 call assert_equal(['two'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1742 \ [0, 2, 3, 0]->getregion([0, 2, 3, 0], {'type': 'V' })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1743 call assert_equal(['one', 'two'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1744 \ '.'->getpos()->getregion([0, 2, 3, 0], {'type': "\<c-v>" })) |
34451
d06ffca91441
patch 9.1.0142: getregion() can be improved
Christian Brabandt <cb@256bit.org>
parents:
34403
diff
changeset
|
1745 |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1746 #" Multiline with line visual mode |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1747 call cursor(1, 1) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1748 call feedkeys("\<ESC>Vjj", 'tx') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1749 call assert_equal(['one', 'two', 'three'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1750 \ getregion(getpos('v'), getpos('.'), {'type': 'V' })) |
34387
e6defaa1e46a
patch 9.1.0120: hard to get visual region using Vim script
Christian Brabandt <cb@256bit.org>
parents:
34344
diff
changeset
|
1751 |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1752 #" Multiline with block visual mode |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1753 call cursor(1, 1) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1754 call feedkeys("\<ESC>\<C-v>jj", 'tx') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1755 call assert_equal(['o', 't', 't'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1756 \ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1757 |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1758 call cursor(1, 1) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1759 call feedkeys("\<ESC>\<C-v>jj$", 'tx') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1760 call assert_equal(['one', 'two', 'three'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1761 \ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1762 |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1763 #" 'virtualedit' |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1764 set virtualedit=all |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1765 call cursor(1, 1) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1766 call feedkeys("\<ESC>\<C-v>10ljj$", 'tx') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1767 call assert_equal(['one ', 'two ', 'three '], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1768 \ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1769 set virtualedit& |
34451
d06ffca91441
patch 9.1.0142: getregion() can be improved
Christian Brabandt <cb@256bit.org>
parents:
34403
diff
changeset
|
1770 |
34520
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1771 #" using wrong types for positions |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1772 call cursor(1, 1) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1773 call feedkeys("\<ESC>vjj$", 'tx') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1774 call assert_fails("call getregion(1, 2)", 'E1211:') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1775 call assert_fails("call getregion(getpos('.'), {})", 'E1211:') |
34520
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1776 call assert_fails(':echo "."->getpos()->getregion("$", [])', 'E1211:') |
35125
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1777 call assert_fails("call getregionpos(1, 2)", 'E1211:') |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1778 call assert_fails("call getregionpos(getpos('.'), {})", 'E1211:') |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1779 call assert_fails(':echo "."->getpos()->getregionpos("$", [])', 'E1211:') |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1780 |
34520
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1781 #" using invalid value for "type" |
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1782 call assert_fails("call getregion(getpos('.'), getpos('.'), {'type': '' })", 'E475:') |
35125
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1783 call assert_fails("call getregionpos(getpos('.'), getpos('.'), {'type': '' })", 'E475:') |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1784 |
34497
7cc0b2479fad
patch 9.1.0155: can only get getregion() from current buffer
Christian Brabandt <cb@256bit.org>
parents:
34457
diff
changeset
|
1785 #" using a mark from another buffer to current buffer |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1786 new |
34520
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1787 LET g:buf = bufnr() |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1788 call setline(1, range(10)) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1789 normal! GmA |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1790 wincmd p |
34520
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1791 call assert_equal([g:buf, 10, 1, 0], getpos("'A")) |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1792 call assert_equal([], getregion(getpos('.'), getpos("'A"), {'type': 'v' })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1793 call assert_equal([], getregion(getpos("'A"), getpos('.'), {'type': 'v' })) |
35125
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1794 call assert_equal([], getregionpos(getpos('.'), getpos("'A"), {'type': 'v' })) |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1795 call assert_equal([], getregionpos(getpos("'A"), getpos('.'), {'type': 'v' })) |
34497
7cc0b2479fad
patch 9.1.0155: can only get getregion() from current buffer
Christian Brabandt <cb@256bit.org>
parents:
34457
diff
changeset
|
1796 |
34520
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1797 #" using two marks from another buffer |
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1798 wincmd p |
34497
7cc0b2479fad
patch 9.1.0155: can only get getregion() from current buffer
Christian Brabandt <cb@256bit.org>
parents:
34457
diff
changeset
|
1799 normal! GmB |
7cc0b2479fad
patch 9.1.0155: can only get getregion() from current buffer
Christian Brabandt <cb@256bit.org>
parents:
34457
diff
changeset
|
1800 wincmd p |
34520
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1801 call assert_equal([g:buf, 10, 1, 0], getpos("'B")) |
35125
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1802 call assert_equal(['9'], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1803 \ getregion(getpos("'B"), getpos("'A"), {'type': 'v' })) |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1804 call assert_equal([ |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1805 \ [[g:buf, 10, 1, 0], [g:buf, 10, 1, 0]], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1806 \ ], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1807 \ getregionpos(getpos("'B"), getpos("'A"), {'type': 'v' })) |
34520
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1808 |
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1809 #" using two positions from another buffer |
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1810 for type in ['v', 'V', "\<C-V>"] |
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1811 for exclusive in [v:false, v:true] |
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1812 call assert_equal(range(10)->mapnew('string(v:val)'), |
34527
c770ad7ac4ab
patch 9.1.0166: Internal error with blockwise getregion() in another buffer
Christian Brabandt <cb@256bit.org>
parents:
34520
diff
changeset
|
1813 \ getregion([g:buf, 1, 1, 0], [g:buf, 10, 2, 0], |
c770ad7ac4ab
patch 9.1.0166: Internal error with blockwise getregion() in another buffer
Christian Brabandt <cb@256bit.org>
parents:
34520
diff
changeset
|
1814 \ {'type': type, 'exclusive': exclusive })) |
34520
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1815 call assert_equal(range(10)->mapnew('string(v:val)'), |
34527
c770ad7ac4ab
patch 9.1.0166: Internal error with blockwise getregion() in another buffer
Christian Brabandt <cb@256bit.org>
parents:
34520
diff
changeset
|
1816 \ getregion([g:buf, 10, 2, 0], [g:buf, 1, 1, 0], |
c770ad7ac4ab
patch 9.1.0166: Internal error with blockwise getregion() in another buffer
Christian Brabandt <cb@256bit.org>
parents:
34520
diff
changeset
|
1817 \ {'type': type, 'exclusive': exclusive })) |
34520
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1818 endfor |
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1819 endfor |
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1820 |
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1821 #" using invalid positions in buffer |
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1822 call assert_fails('call getregion([g:buf, 0, 1, 0], [g:buf, 10, 2, 0])', 'E966:') |
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1823 call assert_fails('call getregion([g:buf, 10, 2, 0], [g:buf, 0, 1, 0])', 'E966:') |
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1824 call assert_fails('call getregion([g:buf, 1, 1, 0], [g:buf, 11, 2, 0])', 'E966:') |
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1825 call assert_fails('call getregion([g:buf, 11, 2, 0], [g:buf, 1, 1, 0])', 'E966:') |
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1826 call assert_fails('call getregion([g:buf, 1, 1, 0], [g:buf, 10, 0, 0])', 'E964:') |
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1827 call assert_fails('call getregion([g:buf, 10, 0, 0], [g:buf, 1, 1, 0])', 'E964:') |
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1828 call assert_fails('call getregion([g:buf, 1, 1, 0], [g:buf, 10, 3, 0])', 'E964:') |
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1829 call assert_fails('call getregion([g:buf, 10, 3, 0], [g:buf, 1, 1, 0])', 'E964:') |
35125
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1830 call assert_fails('call getregion([g:buf, 1, 0, 0], [g:buf, 1, 1, 0])', 'E964:') |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1831 call assert_fails('call getregion([g:buf, 1, 1, 0], [g:buf, 1, 0, 0])', 'E964:') |
34497
7cc0b2479fad
patch 9.1.0155: can only get getregion() from current buffer
Christian Brabandt <cb@256bit.org>
parents:
34457
diff
changeset
|
1832 |
7cc0b2479fad
patch 9.1.0155: can only get getregion() from current buffer
Christian Brabandt <cb@256bit.org>
parents:
34457
diff
changeset
|
1833 #" using invalid buffer |
34520
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1834 call assert_fails('call getregion([10000, 10, 1, 0], [10000, 10, 1, 0])', 'E681:') |
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1835 |
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1836 exe $':{g:buf}bwipe!' |
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
1837 unlet g:buf |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1838 END |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1839 call v9.CheckLegacyAndVim9Success(lines) |
34387
e6defaa1e46a
patch 9.1.0120: hard to get visual region using Vim script
Christian Brabandt <cb@256bit.org>
parents:
34344
diff
changeset
|
1840 |
e6defaa1e46a
patch 9.1.0120: hard to get visual region using Vim script
Christian Brabandt <cb@256bit.org>
parents:
34344
diff
changeset
|
1841 bwipe! |
e6defaa1e46a
patch 9.1.0120: hard to get visual region using Vim script
Christian Brabandt <cb@256bit.org>
parents:
34344
diff
changeset
|
1842 |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1843 let lines =<< trim END |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1844 #" Selection in starts or ends in the middle of a multibyte character |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1845 new |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1846 call setline(1, [ |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1847 \ "abcdefghijk\u00ab", |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1848 \ "\U0001f1e6\u00ab\U0001f1e7\u00ab\U0001f1e8\u00ab\U0001f1e9", |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1849 \ "1234567890" |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1850 \ ]) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1851 call cursor(1, 3) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1852 call feedkeys("\<Esc>\<C-v>ljj", 'xt') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1853 call assert_equal(['cd', "\u00ab ", '34'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1854 \ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1855 call cursor(1, 4) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1856 call feedkeys("\<Esc>\<C-v>ljj", 'xt') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1857 call assert_equal(['de', "\U0001f1e7", '45'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1858 \ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1859 call cursor(1, 5) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1860 call feedkeys("\<Esc>\<C-v>jj", 'xt') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1861 call assert_equal(['e', ' ', '5'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1862 \ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" })) |
35125
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1863 call assert_equal([ |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1864 \ [[bufnr('%'), 1, 5, 0], [bufnr('%'), 1, 13, 0]], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1865 \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 22, 0]], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1866 \ [[bufnr('%'), 3, 1, 0], [bufnr('%'), 3, 5, 0]], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1867 \ ], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1868 \ getregionpos(getpos('v'), getpos('.'), {'type': 'v' })) |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1869 call cursor(1, 1) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1870 call feedkeys("\<Esc>vj", 'xt') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1871 call assert_equal(['abcdefghijk«', "\U0001f1e6"], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1872 \ getregion(getpos('v'), getpos('.'), {'type': 'v' })) |
34451
d06ffca91441
patch 9.1.0142: getregion() can be improved
Christian Brabandt <cb@256bit.org>
parents:
34403
diff
changeset
|
1873 |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1874 #" marks on multibyte chars |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1875 :set selection=exclusive |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1876 call setpos("'a", [0, 1, 11, 0]) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1877 call setpos("'b", [0, 2, 16, 0]) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1878 call setpos("'c", [0, 2, 0, 0]) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1879 call cursor(1, 1) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1880 call assert_equal(['ghijk', '🇨«🇩'], |
35125
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
1881 \ getregion(getpos("'a"), getpos("'b"), {'type': "\<C-v>" })) |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1882 call assert_equal(['k«', '🇦«🇧«🇨'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1883 \ getregion(getpos("'a"), getpos("'b"), {'type': 'v' })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1884 call assert_equal(['k«'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1885 \ getregion(getpos("'a"), getpos("'c"), {'type': 'v' })) |
34387
e6defaa1e46a
patch 9.1.0120: hard to get visual region using Vim script
Christian Brabandt <cb@256bit.org>
parents:
34344
diff
changeset
|
1886 |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1887 #" use inclusive selection, although 'selection' is exclusive |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1888 call setpos("'a", [0, 1, 11, 0]) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1889 call setpos("'b", [0, 1, 1, 0]) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1890 call assert_equal(['abcdefghijk'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1891 \ getregion(getpos("'a"), getpos("'b"), |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1892 \ {'type': "\<c-v>", 'exclusive': v:false })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1893 call assert_equal(['abcdefghij'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1894 \ getregion(getpos("'a"), getpos("'b"), |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1895 \ {'type': "\<c-v>", 'exclusive': v:true })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1896 call assert_equal(['abcdefghijk'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1897 \ getregion(getpos("'a"), getpos("'b"), |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1898 \ {'type': 'v', 'exclusive': 0 })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1899 call assert_equal(['abcdefghij'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1900 \ getregion(getpos("'a"), getpos("'b"), |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1901 \ {'type': 'v', 'exclusive': 1 })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1902 call assert_equal(['abcdefghijk«'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1903 \ getregion(getpos("'a"), getpos("'b"), |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1904 \ {'type': 'V', 'exclusive': 0 })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1905 call assert_equal(['abcdefghijk«'], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1906 \ getregion(getpos("'a"), getpos("'b"), |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1907 \ {'type': 'V', 'exclusive': 1 })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1908 :set selection& |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1909 END |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1910 call v9.CheckLegacyAndVim9Success(lines) |
34387
e6defaa1e46a
patch 9.1.0120: hard to get visual region using Vim script
Christian Brabandt <cb@256bit.org>
parents:
34344
diff
changeset
|
1911 |
e6defaa1e46a
patch 9.1.0120: hard to get visual region using Vim script
Christian Brabandt <cb@256bit.org>
parents:
34344
diff
changeset
|
1912 bwipe! |
34457
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1913 |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1914 let lines =<< trim END |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1915 #" Exclusive selection |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1916 new |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1917 set selection=exclusive |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1918 call setline(1, ["a\tc", "x\tz", '', '']) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1919 call cursor(1, 1) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1920 call feedkeys("\<Esc>v2l", 'xt') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1921 call assert_equal(["a\t"], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1922 \ getregion(getpos('v'), getpos('.'), {'type': 'v' })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1923 call cursor(1, 1) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1924 call feedkeys("\<Esc>v$G", 'xt') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1925 call assert_equal(["a\tc", "x\tz", ''], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1926 \ getregion(getpos('v'), getpos('.'), {'type': 'v' })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1927 call cursor(1, 1) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1928 call feedkeys("\<Esc>v$j", 'xt') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1929 call assert_equal(["a\tc", "x\tz"], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1930 \ getregion(getpos('v'), getpos('.'), {'type': 'v' })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1931 call cursor(1, 1) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1932 call feedkeys("\<Esc>\<C-v>$j", 'xt') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1933 call assert_equal(["a\tc", "x\tz"], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1934 \ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1935 call cursor(1, 1) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1936 call feedkeys("\<Esc>\<C-v>$G", 'xt') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1937 call assert_equal(["a", "x", '', ''], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1938 \ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1939 call cursor(1, 1) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1940 call feedkeys("\<Esc>wv2j", 'xt') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1941 call assert_equal(["c", "x\tz"], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1942 \ getregion(getpos('v'), getpos('.'), {'type': 'v' })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1943 set selection& |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1944 |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1945 #" Exclusive selection 2 |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1946 new |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1947 call setline(1, ["a\tc", "x\tz", '', '']) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1948 call cursor(1, 1) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1949 call feedkeys("\<Esc>v2l", 'xt') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1950 call assert_equal(["a\t"], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1951 \ getregion(getpos('v'), getpos('.'), {'exclusive': v:true })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1952 call cursor(1, 1) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1953 call feedkeys("\<Esc>v$G", 'xt') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1954 call assert_equal(["a\tc", "x\tz", ''], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1955 \ getregion(getpos('v'), getpos('.'), {'exclusive': v:true })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1956 call cursor(1, 1) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1957 call feedkeys("\<Esc>v$j", 'xt') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1958 call assert_equal(["a\tc", "x\tz"], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1959 \ getregion(getpos('v'), getpos('.'), {'exclusive': v:true })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1960 call cursor(1, 1) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1961 call feedkeys("\<Esc>\<C-v>$j", 'xt') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1962 call assert_equal(["a\tc", "x\tz"], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1963 \ getregion(getpos('v'), getpos('.'), |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1964 \ {'exclusive': v:true, 'type': "\<C-v>" })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1965 call cursor(1, 1) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1966 call feedkeys("\<Esc>\<C-v>$G", 'xt') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1967 call assert_equal(["a", "x", '', ''], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1968 \ getregion(getpos('v'), getpos('.'), |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1969 \ {'exclusive': v:true, 'type': "\<C-v>" })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1970 call cursor(1, 1) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1971 call feedkeys("\<Esc>wv2j", 'xt') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1972 call assert_equal(["c", "x\tz"], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1973 \ getregion(getpos('v'), getpos('.'), {'exclusive': v:true })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1974 |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1975 #" virtualedit |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1976 set selection=exclusive |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1977 set virtualedit=all |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1978 call cursor(1, 1) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1979 call feedkeys("\<Esc>2lv2lj", 'xt') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1980 call assert_equal([' c', 'x '], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1981 \ getregion(getpos('v'), getpos('.'), {'type': 'v' })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1982 call cursor(1, 1) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1983 call feedkeys("\<Esc>2l\<C-v>2l2j", 'xt') |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1984 call assert_equal([' ', ' ', ' '], |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1985 \ getregion(getpos('v'), getpos('.'), {'type': "\<C-v>" })) |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1986 set virtualedit& |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1987 set selection& |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1988 |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1989 bwipe! |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1990 END |
125dcecbfa09
patch 9.1.0144: getregion() needs more tests
Christian Brabandt <cb@256bit.org>
parents:
34451
diff
changeset
|
1991 call v9.CheckLegacyAndVim9Success(lines) |
34387
e6defaa1e46a
patch 9.1.0120: hard to get visual region using Vim script
Christian Brabandt <cb@256bit.org>
parents:
34344
diff
changeset
|
1992 endfunc |
e6defaa1e46a
patch 9.1.0120: hard to get visual region using Vim script
Christian Brabandt <cb@256bit.org>
parents:
34344
diff
changeset
|
1993 |
34497
7cc0b2479fad
patch 9.1.0155: can only get getregion() from current buffer
Christian Brabandt <cb@256bit.org>
parents:
34457
diff
changeset
|
1994 func Test_getregion_invalid_buf() |
7cc0b2479fad
patch 9.1.0155: can only get getregion() from current buffer
Christian Brabandt <cb@256bit.org>
parents:
34457
diff
changeset
|
1995 new |
7cc0b2479fad
patch 9.1.0155: can only get getregion() from current buffer
Christian Brabandt <cb@256bit.org>
parents:
34457
diff
changeset
|
1996 help |
7cc0b2479fad
patch 9.1.0155: can only get getregion() from current buffer
Christian Brabandt <cb@256bit.org>
parents:
34457
diff
changeset
|
1997 call cursor(5, 7) |
7cc0b2479fad
patch 9.1.0155: can only get getregion() from current buffer
Christian Brabandt <cb@256bit.org>
parents:
34457
diff
changeset
|
1998 norm! mA |
7cc0b2479fad
patch 9.1.0155: can only get getregion() from current buffer
Christian Brabandt <cb@256bit.org>
parents:
34457
diff
changeset
|
1999 call cursor(5, 18) |
7cc0b2479fad
patch 9.1.0155: can only get getregion() from current buffer
Christian Brabandt <cb@256bit.org>
parents:
34457
diff
changeset
|
2000 norm! mB |
7cc0b2479fad
patch 9.1.0155: can only get getregion() from current buffer
Christian Brabandt <cb@256bit.org>
parents:
34457
diff
changeset
|
2001 call assert_equal(['Move around:'], getregion(getpos("'A"), getpos("'B"))) |
7cc0b2479fad
patch 9.1.0155: can only get getregion() from current buffer
Christian Brabandt <cb@256bit.org>
parents:
34457
diff
changeset
|
2002 " close the help window |
7cc0b2479fad
patch 9.1.0155: can only get getregion() from current buffer
Christian Brabandt <cb@256bit.org>
parents:
34457
diff
changeset
|
2003 q |
34520
f9a0bf1e7505
patch 9.1.0164: Internal error when passing invalid position to getregion()
Christian Brabandt <cb@256bit.org>
parents:
34497
diff
changeset
|
2004 call assert_fails("call getregion(getpos(\"'A\"), getpos(\"'B\"))", 'E681:') |
34497
7cc0b2479fad
patch 9.1.0155: can only get getregion() from current buffer
Christian Brabandt <cb@256bit.org>
parents:
34457
diff
changeset
|
2005 bwipe! |
7cc0b2479fad
patch 9.1.0155: can only get getregion() from current buffer
Christian Brabandt <cb@256bit.org>
parents:
34457
diff
changeset
|
2006 endfunc |
7cc0b2479fad
patch 9.1.0155: can only get getregion() from current buffer
Christian Brabandt <cb@256bit.org>
parents:
34457
diff
changeset
|
2007 |
35125
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
2008 func Test_getregion_maxcol() |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
2009 new |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
2010 autocmd TextYankPost * |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
2011 \ : if v:event.operator ==? 'y' |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
2012 \ | call assert_equal([ |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
2013 \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 4, 0]], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
2014 \ ], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
2015 \ getregionpos(getpos("'["), getpos("']"), |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
2016 \ #{ mode: visualmode() })) |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
2017 \ | call assert_equal(['abcd'], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
2018 \ getregion(getpos("'["), getpos("']"), |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
2019 \ #{ mode: visualmode() })) |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
2020 \ | call assert_equal([ |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
2021 \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 4, 0]], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
2022 \ ], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
2023 \ getregionpos(getpos("']"), getpos("'["), |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
2024 \ #{ mode: visualmode() })) |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
2025 \ | call assert_equal(['abcd'], |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
2026 \ getregion(getpos("']"), getpos("'["), |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
2027 \ #{ mode: visualmode() })) |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
2028 \ | endif |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
2029 call setline(1, ['abcd', 'efghij']) |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
2030 normal yy |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
2031 bwipe! |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
2032 endfunc |
9322493ebe58
patch 9.1.0394: Cannot get a list of positions describing a region
Christian Brabandt <cb@256bit.org>
parents:
35097
diff
changeset
|
2033 |
35139
617f9087f97c
patch 9.1.0399: block_editing errors out when using del
Christian Brabandt <cb@256bit.org>
parents:
35125
diff
changeset
|
2034 func Test_visual_block_cursor_delete() |
617f9087f97c
patch 9.1.0399: block_editing errors out when using del
Christian Brabandt <cb@256bit.org>
parents:
35125
diff
changeset
|
2035 new |
617f9087f97c
patch 9.1.0399: block_editing errors out when using del
Christian Brabandt <cb@256bit.org>
parents:
35125
diff
changeset
|
2036 call setline(1, 'ab') |
617f9087f97c
patch 9.1.0399: block_editing errors out when using del
Christian Brabandt <cb@256bit.org>
parents:
35125
diff
changeset
|
2037 exe ":norm! $\<c-v>hI\<Del>\<ESC>" |
617f9087f97c
patch 9.1.0399: block_editing errors out when using del
Christian Brabandt <cb@256bit.org>
parents:
35125
diff
changeset
|
2038 call assert_equal(['b'], getline(1, 1)) |
617f9087f97c
patch 9.1.0399: block_editing errors out when using del
Christian Brabandt <cb@256bit.org>
parents:
35125
diff
changeset
|
2039 bwipe! |
617f9087f97c
patch 9.1.0399: block_editing errors out when using del
Christian Brabandt <cb@256bit.org>
parents:
35125
diff
changeset
|
2040 endfunc |
617f9087f97c
patch 9.1.0399: block_editing errors out when using del
Christian Brabandt <cb@256bit.org>
parents:
35125
diff
changeset
|
2041 |
18771
50fde4e20790
patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents:
16419
diff
changeset
|
2042 " vim: shiftwidth=2 sts=2 expandtab |