annotate src/testdir/test_visual.vim @ 19642:647ef636a11e v8.2.0378

patch 8.2.0378: prop_find() does not find all props Commit: https://github.com/vim/vim/commit/346f18e5fe12e6aaba5a6a18f6d0deb55eb7a9e8 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Mar 13 21:36:40 2020 +0100 patch 8.2.0378: prop_find() does not find all props Problem: prop_find() does not find all props. Solution: Check being in the start line. (Axel Forsman, closes https://github.com/vim/vim/issues/5776)
author Bram Moolenaar <Bram@vim.org>
date Fri, 13 Mar 2020 21:45:03 +0100
parents f70a3c1000bb
children 0208534b8a84
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
8401
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 func Test_block_shift_multibyte()
10494
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
4 " Uses double-wide character.
8401
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 split
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 call setline(1, ['xヹxxx', 'ヹxxx'])
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 exe "normal 1G0l\<C-V>jl>"
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 call assert_equal('x ヹxxx', getline(1))
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 call assert_equal(' ヹxxx', getline(2))
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 q!
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 endfunc
10494
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
12
11997
66b677c77467 patch 8.0.0879: crash when shifting with huge number
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
13 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
14 " 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
15 new
66b677c77467 patch 8.0.0879: crash when shifting with huge number
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
16 normal ii
66b677c77467 patch 8.0.0879: crash when shifting with huge number
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
17 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
18 q!
66b677c77467 patch 8.0.0879: crash when shifting with huge number
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
19 endfunc
66b677c77467 patch 8.0.0879: crash when shifting with huge number
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
20
10494
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
21 func Test_dotregister_paste()
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
22 new
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
23 exe "norm! ihello world\<esc>"
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
24 norm! 0ve".p
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
25 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
26 q!
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
27 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
28
065da86ca6d2 patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents: 10494
diff changeset
29 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
30 new
065da86ca6d2 patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents: 10494
diff changeset
31 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
32 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
33 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
34 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
35 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
36 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
37 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
38 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
39 bw!
065da86ca6d2 patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents: 10494
diff changeset
40 endfu
10881
8f6df2f6d2fc patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents: 10803
diff changeset
41
8f6df2f6d2fc patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents: 10803
diff changeset
42 func Test_Visual_vapo()
8f6df2f6d2fc patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents: 10803
diff changeset
43 new
8f6df2f6d2fc patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents: 10803
diff changeset
44 normal oxx
8f6df2f6d2fc patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents: 10803
diff changeset
45 normal vapo
8f6df2f6d2fc patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents: 10803
diff changeset
46 bwipe!
8f6df2f6d2fc patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents: 10803
diff changeset
47 endfunc
10900
9b4574d95571 patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents: 10881
diff changeset
48
9b4574d95571 patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents: 10881
diff changeset
49 func Test_Visual_inner_quote()
9b4574d95571 patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents: 10881
diff changeset
50 new
9b4574d95571 patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents: 10881
diff changeset
51 normal oxX
9b4574d95571 patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents: 10881
diff changeset
52 normal vki'
9b4574d95571 patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents: 10881
diff changeset
53 bwipe!
9b4574d95571 patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents: 10881
diff changeset
54 endfunc
12019
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
55
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
56 " 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
57 func TriggerTheProblem()
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
58 " 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
59 " Let's restore the selection:
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
60 normal gv
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
61 '<,'>del _
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
62 try
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
63 exe "normal \<Esc>"
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
64 catch /^Vim\%((\a\+)\)\=:E315/
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
65 echom 'Snap! E315 error!'
13402
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
66 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
67 endtry
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
68 endfunc
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
69
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
70 func Test_visual_mode_reset()
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
71 enew
13402
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
72 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
73 enew
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
74 setl buftype=nofile
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
75 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
76
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
77 " 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
78 " 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
79 " thus preventing the problem:
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
80 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
81 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
82
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
83 endfunc
12644
1fad9675d8fd patch 8.0.1200: tests switch the bell off twice
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
84
12686
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
85 " 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
86 func Test_block_shift_tab()
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
87 enew!
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
88 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
89 call cursor(1,1)
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
90 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
91 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
92 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
93 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
94 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
95
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
96 enew!
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
97 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
98 call cursor(1,1)
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
99 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
100 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
101 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
102 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
103 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
104 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
105 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
106 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
107 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
108
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
109 %s/\s\+//g
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
110 call cursor(1,1)
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
111 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
112 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
113 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
114 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
115 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
116 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
117 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
118 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
119 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
120
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
121 enew!
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
122 endfunc
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
123
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
124 " 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
125 func Test_blockwise_visual()
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
126 enew!
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
127 call append(0, ['123456',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
128 \ '234567',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
129 \ '345678',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
130 \ '',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
131 \ '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
132 \ "\t\tsome text",
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
133 \ "\t\ttest text",
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
134 \ 'test text'])
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
135 call cursor(1,1)
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
136 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
137 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
138 exe "normal /456$\<CR>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
139 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
140 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
141 \ '234start here67',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
142 \ '345start here78',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
143 \ '',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
144 \ '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
145 \ "\t\tsomext",
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
146 \ "\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
147
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
148 enew!
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
149 endfunc
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
150
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
151 " 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
152 func Test_blockwise_visual_o_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
153 enew!
81c324144452 patch 8.1.0007: no test for "o" and "O" in Visual block mode
Christian Brabandt <cb@256bit.org>
parents: 13410
diff changeset
154
81c324144452 patch 8.1.0007: no test for "o" and "O" in Visual block mode
Christian Brabandt <cb@256bit.org>
parents: 13410
diff changeset
155 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
156 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
157 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
158 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
159 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
160 set selection=exclusive
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
161 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
162 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
163 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
164 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
165
81c324144452 patch 8.1.0007: no test for "o" and "O" in Visual block mode
Christian Brabandt <cb@256bit.org>
parents: 13410
diff changeset
166 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
167 \ '...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
168 \ '... ..',
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
169 \ '...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
170 \ '..........'], 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
171
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 enew!
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 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
174
12686
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
175 " Test Virtual replace mode.
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
176 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
177 if exists('&t_kD')
c571356c65bd patch 8.0.1579: virtual replace test fails in GUI
Christian Brabandt <cb@256bit.org>
parents: 13406
diff changeset
178 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
179 endif
c571356c65bd patch 8.0.1579: virtual replace test fails in GUI
Christian Brabandt <cb@256bit.org>
parents: 13406
diff changeset
180 if exists('&t_kb')
c571356c65bd patch 8.0.1579: virtual replace test fails in GUI
Christian Brabandt <cb@256bit.org>
parents: 13406
diff changeset
181 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
182 endif
12686
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
183 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
184 enew!
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
185 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
186 call cursor(1,1)
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
187 set ai bs=2
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
188 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
189 call assert_equal([' 1',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
190 \ ' A',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
191 \ ' BCDEFGHIJ',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
192 \ ' KL',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
193 \ ' MNO',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
194 \ ' PQR',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
195 \ ], getline(1, 6))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
196 normal G
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
197 mark a
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
198 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
199 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
200 call assert_equal([' 1',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
201 \ 'abcdefghi',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
202 \ 'jk lmn',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
203 \ ' opq rst',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
204 \ 'uvwxyz'], getline(7, 11))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
205 normal G
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
206 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
207 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
208 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
209 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
210 \ 'AB IJKLMNO QRst'], getline(12, 13))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
211 enew!
13406
4e30f3f4cb78 patch 8.0.1577: virtual replace test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 13402
diff changeset
212 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
213 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
214 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
215 endif
c571356c65bd patch 8.0.1579: virtual replace test fails in GUI
Christian Brabandt <cb@256bit.org>
parents: 13406
diff changeset
216 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
217 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
218 endif
12686
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
219 endfunc
13402
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
220
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
221 " Test Virtual replace mode.
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
222 func Test_virtual_replace2()
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
223 enew!
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
224 set bs=2
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
225 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
226 call cursor(1,1)
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
227 " 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
228 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
229 call assert_equal(['0 1',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
230 \ 'A',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
231 \ 'BCDEFGHIJ',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
232 \ ' KL',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
233 \ 'MNO',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
234 \ 'PQR',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
235 \ ], getline(1, 6))
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
236 " Test 2:
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
237 " 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
238 %d_
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
239 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
240 call cursor(2,1)
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
241 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
242 call assert_equal(['abcd',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
243 \ '123h',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
244 \ 'ijkl'], getline(1, '$'))
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
245 " Test 3:
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
246 " 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
247 %d_
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
248 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
249 call cursor(2,1)
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
250 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
251 call assert_equal(['abcd',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
252 \ '1234',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
253 \ 'ijkl'], getline(1, '$'))
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
254 " Test 4:
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
255 " 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
256 %d_
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
257 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
258 call cursor(2,1)
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
259 " break undo sequence explicitly
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
260 let &ul = &ul
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
261 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
262 let &ul = &ul
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
263 call assert_equal(['abcd',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
264 \ '123456',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
265 \ ''], getline(1, '$'))
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
266 norm! u
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
267 call assert_equal(['abcd',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
268 \ 'efgh',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
269 \ 'ijkl'], getline(1, '$'))
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
270 " clean up
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
271 %d_
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
272 set bs&vim
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
273 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
274
15462
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
275 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
276 new
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
277 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
278
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
279 " 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
280 " the whole word.
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
281 norm! 1go2fcvawy
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
282 call assert_equal('Second ', @")
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
283 norm! 1go2fcviwy
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
284 call assert_equal('Second', @")
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
285
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
286 " 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
287 " 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
288 norm! 1go2fcvlawy
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
289 call assert_equal('cond ', @")
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
290 norm! gv2awy
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
291 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
292
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
293 norm! 1go2fcvliwy
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
294 call assert_equal('cond', @")
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
295 norm! gv2iwy
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
296 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
297
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
298 " 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
299 norm! 1go2fcvhawy
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
300 call assert_equal(' Sec', @")
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
301 norm! gv2awy
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
302 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
303
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
304 norm! 1go2fcvhiwy
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
305 call assert_equal('Sec', @")
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
306 norm! gv2iwy
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
307 call assert_equal('. Sec', @")
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
308
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
309 bwipe!
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
310 endfunc
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
311
15359
bdf5f546eba0 patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents: 13978
diff changeset
312 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
313 new
15462
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
314 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
315
bdf5f546eba0 patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents: 13978
diff changeset
316 " 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
317 " 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
318 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
319 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
320 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
321 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
322
bdf5f546eba0 patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents: 13978
diff changeset
323 " 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
324 " 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
325 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
326 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
327 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
328 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
329
bdf5f546eba0 patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents: 13978
diff changeset
330 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
331 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
332 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
333 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
334 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
335 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
336
bdf5f546eba0 patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents: 13978
diff changeset
337 " 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
338 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
339 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
340 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
341 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
342
bdf5f546eba0 patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents: 13978
diff changeset
343 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
344 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
345 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
346 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
347 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
348 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
349
bdf5f546eba0 patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents: 13978
diff changeset
350 bwipe!
bdf5f546eba0 patch 8.1.0687: sentence text object in Visual mode is not tested
Bram Moolenaar <Bram@vim.org>
parents: 13978
diff changeset
351 endfunc
15462
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
352
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
353 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
354 new
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
355 call setline(1, ['First line.',
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
356 \ '',
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
357 \ 'Second line.',
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
358 \ 'Third line.',
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
359 \ 'Fourth line.',
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
360 \ 'Fifth line.',
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
361 \ '',
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
362 \ 'Sixth line.'])
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
363
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
364 " 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
365 " the whole paragraph.
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
366 norm! 4ggvapy
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
367 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
368 norm! 4ggvipy
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
369 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
370
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
371 " 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
372 " 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
373 " 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
374 " 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
375 " 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
376 norm! 4ggVjapy
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
377 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
378 norm! gvapy
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
379 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
380 norm! 4ggVjipy
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
381 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
382 norm! gvipy
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
383 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
384 norm! gvipy
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
385 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
386
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
387 " 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
388 norm! 5ggVkapy
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
389 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
390 norm! gvapy
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
391 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
392 norm! 5ggVkipy
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
393 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
394 norma gvipy
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
395 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
396 norm! gvipy
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
397 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
398
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
399 bwipe!
2c44001e7e13 patch 8.1.0739: text objects in not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 15359
diff changeset
400 endfunc
15985
e91750e8adb5 patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
401
e91750e8adb5 patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
402 func Test_curswant_not_changed()
e91750e8adb5 patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
403 new
e91750e8adb5 patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
404 call setline(1, ['one', 'two'])
e91750e8adb5 patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
405 au InsertLeave * call getcurpos()
e91750e8adb5 patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
406 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
407 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
408
e91750e8adb5 patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
409 bwipe!
e91750e8adb5 patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
410 au! InsertLeave
e91750e8adb5 patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
411 endfunc
16419
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 15985
diff changeset
412
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 15985
diff changeset
413 " Tests for "vaBiB", end could be wrong.
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 15985
diff changeset
414 func Test_Visual_Block()
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 15985
diff changeset
415 new
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 15985
diff changeset
416 a
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 15985
diff changeset
417 - Bug in "vPPPP" on this text:
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 15985
diff changeset
418 {
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 15985
diff changeset
419 cmd;
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 15985
diff changeset
420 {
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 15985
diff changeset
421 cmd;\t/* <-- Start cursor here */
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 15985
diff changeset
422 {
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 15985
diff changeset
423 }
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 15985
diff changeset
424 }
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 15985
diff changeset
425 }
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 15985
diff changeset
426 .
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 15985
diff changeset
427 normal gg
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 15985
diff changeset
428 call search('Start cursor here')
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 15985
diff changeset
429 normal vaBiBD
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 15985
diff changeset
430 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
431 \ "\t{",
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 15985
diff changeset
432 \ "\t}"], getline(1, '$'))
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 15985
diff changeset
433
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 15985
diff changeset
434 close!
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 15985
diff changeset
435 endfunc
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
436
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
437 " 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
438 func Test_visual_block_put()
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
439 enew
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
440
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
441 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
442 normal gg
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
443 yank
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
444 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
445 call assert_equal(['One', 'T', 'Tee', 'One', ''], getline(1, '$'))
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
446
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
447 enew!
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
448 endfunc
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
449
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
450 " 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
451 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
452 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
453 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
454
2d41b63f52de patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
455 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
456 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
457 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
458 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
459
2d41b63f52de patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
460 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
461 \ '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
462 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
463 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
464 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
465
2d41b63f52de patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
466 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
467 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
468 \ '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
469 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
470 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
471 \ ' --------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
472 \ '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
473 \ '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
474
2d41b63f52de patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
475 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
476 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
477
2d41b63f52de patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
478 " 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
479 " 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
480 " - 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
481 " - 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
482 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
483 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
484 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
485
2d41b63f52de patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
486 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
487 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
488 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
489 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
490 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
491 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
492 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
493
2d41b63f52de patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
494 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
495 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
496
2d41b63f52de patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
497 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
498 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
499 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
500 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
501
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 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
503 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
504 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
505 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
506
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 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
508 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
509 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
510 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
511 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
512
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 " 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
514 " - 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
515 " - 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
516 " - 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
517 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
518 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
519 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
520
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 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
522 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
523 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
524
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 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
526 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
527 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
528 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
529 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
530 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
531 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
532
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 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
534 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
535 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
536
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 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
538 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
539 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
540 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
541
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 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
543 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
544 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
545 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
546
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 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
548 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
549 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
550 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
551
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 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
553 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
554 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
555 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
556 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
557 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
558 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
559
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 " 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
561 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
562 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
563 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
564
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 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
566 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
567
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 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
569 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
570 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
571 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
572 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
573 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
574 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
575 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
576 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
577 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
578 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
579 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
580
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 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
582 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
583
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 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
585 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
586
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 " 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
588 $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
589 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
590 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
591 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
592
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 " 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
594 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
595 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
596 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
597 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
598 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
599
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 " 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
601 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
602 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
603 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
604 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
605
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 " 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
607 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
608 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
609 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
610 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
611
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 " 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
613 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
614 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
615 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
616 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
617
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 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
619 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
620
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 func Test_characterwise_select_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
622 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
623
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 " Select 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
625 snoremap <lt>End> <End>
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 snoremap <lt>Down> <Down>
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 snoremap <lt>Del> <Del>
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
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 " characterwise select 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
630 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
631 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
632 exe "normal Gkkgh\<End>\<Del>"
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 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
634
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 " characterwise select 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
636 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
637 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
638 exe "normal Gkkgh\<Down>\<End>\<Del>"
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 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
640
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 " characterwise select 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
642 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
643 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
644 exe "normal Ggh\<End>\<Del>"
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 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
646
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 " characterwise select 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
648 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
649 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
650 exe "normal Gkgh\<Down>\<End>\<Del>"
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 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
652
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
653 " CTRL-H in select mode behaves like 'x'
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
654 call setline(1, 'abcdef')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
655 exe "normal! gggh\<Right>\<Right>\<Right>\<C-H>"
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
656 call assert_equal('ef', getline(1))
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
657
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
658 " CTRL-O in select mode switches to visual mode for one command
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
659 call setline(1, 'abcdef')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
660 exe "normal! gggh\<C-O>3lm"
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
661 call assert_equal('mef', getline(1))
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
662
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
663 sunmap <lt>End>
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 sunmap <lt>Down>
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 sunmap <lt>Del>
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 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
667 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
668
2d41b63f52de patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
669 func Test_linewise_select_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
670 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
671
2d41b63f52de patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
672 " linewise select 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
673 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
674 exe "normal GkkgH\<Del>"
2d41b63f52de patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
675 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
676
2d41b63f52de patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
677 " linewise select 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
678 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
679 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
680 exe "normal GkkgH\<Down>\<Del>"
2d41b63f52de patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
681 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
682
2d41b63f52de patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
683 " linewise select 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
684 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
685 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
686 exe "normal GgH\<Del>"
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 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
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 " linewise select 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
690 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
691 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
692 exe "normal GkgH\<Down>\<Del>"
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 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
694
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 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
696 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
697
19613
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
698 " Test for blockwise select mode (g CTRL-H)
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
699 func Test_blockwise_select_mode()
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
700 new
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
701 call setline(1, ['foo', 'bar'])
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
702 call feedkeys("g\<BS>\<Right>\<Down>mm", 'xt')
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
703 call assert_equal(['mmo', 'mmr'], getline(1, '$'))
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
704 close!
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
705 endfunc
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
706
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
707 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
708 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
709
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 " 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
711 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
712 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
713 -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
714 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
715 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
716
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 " 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
718 " 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
719 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
720 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
721 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
722 -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
723 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
724 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
725
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 " 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
727 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
728 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
729 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
730 -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
731 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
732 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
733
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 " 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
735 " 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
736 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
737 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
738 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
739 -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
740 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
741 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
742
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 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
744 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
745
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 func Test_select_mode_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
747 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
748
2d41b63f52de patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
749 " gv in exclusive select mode after operation
2d41b63f52de patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
750 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
751 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
752 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
753 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
754
2d41b63f52de patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
755 " gv in exclusive select mode without operation
2d41b63f52de patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
756 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
757 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
758 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
759 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
760 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
761
2d41b63f52de patch 8.1.2390: test94 is old style, fix 7.4.441 not tested
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
762 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
763 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
764 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
765
18825
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
766 " 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
767 func Test_visual_block_mode()
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
768 new
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
769 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
770 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
771 call cursor(1, 1)
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
772
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
773 " Test shift-right of a block
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
774 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
775 " Test shift-left of a block
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
776 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
777 " Test block-insert
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
778 exe "normal Gkl\<C-V>kkkIxyz"
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
779 " Test block-replace
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
780 exe "normal Gllll\<C-V>kkklllrq"
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
781 " Test block-change
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
782 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
783 call assert_equal(['axyzbcdefghijklm',
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
784 \ 'axyzqqqq mno ghijklm',
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
785 \ 'axyzqqqqef mno ghijklm',
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
786 \ 'axyzqqqqefgmnoklm',
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
787 \ 'abcdqqqqijklm'], getline(1, 5))
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
788
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
789 " 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
790 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
791 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
792 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
793
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
794 " 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
795 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
796 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
797 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
798
18825
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
799 bwipe!
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
800 endfunc
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
801
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
802 " 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
803 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
804 new
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
805 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
806 call cursor(1, 1)
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
807
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
808 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
809 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
810 \ getline(1, 4))
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
811
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
812 call deletebufline('', 1, '$')
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
813 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
814 call cursor(1, 1)
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
815 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
816 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
817 \ getline(1, 4))
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
818 bwipe!
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
819 endfunc
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
820
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
821 func Test_visual_block_create()
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
822 new
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
823 call append(0, '')
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
824 " 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
825 call setline(1, ['A23', '4567'])
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
826 call cursor(1, 1)
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
827 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
828 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
829
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
830 " 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
831 call deletebufline('', 1, '$')
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
832 call setline(1, ['B23', '4567'])
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
833 call cursor(1, 1)
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
834 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
835 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
836
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
837 " 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
838 call deletebufline('', 1, '$')
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
839 call setline(1, ['C23', '4567'])
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
840 call cursor(1, 1)
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
841 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
842 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
843 bwipe!
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
844 endfunc
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
845
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
846 " 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
847 func Test_virtualedit_visual_block()
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
848 set ve=all
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
849 new
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
850 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
851 call cursor(1, 1)
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
852 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
853 call assert_equal([" x \tline1",
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
854 \ " x \tline2",
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
855 \ " x \tline3"], getline(1, 3))
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
856
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
857 " 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
858 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
859 call assert_equal([' x x line1',
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
860 \ ' x x line2',
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
861 \ ' x x line3'], getline(1, 3))
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
862 set ve=
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
863 bwipe!
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
864 endfunc
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
865
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
866 " Test for changing case
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
867 func Test_visual_change_case()
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
868 new
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
869 " gUe must uppercase a whole word, also when ß changes to SS
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
870 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
871 " gUfx must uppercase until x, inclusive.
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
872 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
873 " VU must uppercase a whole line
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
874 exe "normal YpkVU\r"
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
875 " 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
876 exe "normal YPGi111\<Esc>VUddP\r"
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
877 " Uppercase two lines
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
878 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
879 " Uppercase part of two lines
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
880 exe "normal ddppi333\<Esc>k0i222\<Esc>fyllvjfuUk"
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
881 call assert_equal(['the YOUTUSSEUU end', '- yOUSSTUSSEXu -',
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
882 \ 'THE YOUTUSSEUU END', '111THE YOUTUSSEUU END', 'BLAH DI', 'DOH DUT',
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
883 \ '222the yoUTUSSEUU END', '333THE YOUTUßeuu end'], getline(2, '$'))
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
884 bwipe!
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
885 endfunc
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
886
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
887 " 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
888 func Test_visual_replace_crnl()
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
889 new
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
890 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
891 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
892 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
893 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
894 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
895 \ "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
896 \ "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
897 bwipe!
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
898 endfunc
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
899
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
900 func Test_ve_block_curpos()
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
901 new
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
902 " 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
903 call append(0, ['12345', '789'])
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
904 call cursor(1, 3)
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
905 set virtualedit=block
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
906 exe "norm! \<C-V>$gj\<Esc>"
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
907 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
908 set virtualedit=
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
909 bwipe!
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
910 endfunc
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
911
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
912 " 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
913 func Test_block_insert_replace_tabs()
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
914 new
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
915 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
916 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
917 \ "#define BO_BS\t 0x0002",
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
918 \ "#define BO_CRSR\t 0x0004"])
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
919 call cursor(1, 1)
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
920 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
921 call assert_equal([
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
922 \ "#define BO_ALL\t\t0x0001",
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
923 \ "#define BO_BS\t \t0x0002",
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
924 \ "#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
925 set ts& sts& sw&
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
926 bwipe!
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
927 endfunc
70f1e352d599 patch 8.1.2400: test39 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18804
diff changeset
928
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18825
diff changeset
929 " Test for * register in :
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18825
diff changeset
930 func Test_star_register()
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18825
diff changeset
931 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
932 new
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18825
diff changeset
933 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
934 exe "normal jVj\<ESC>"
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18825
diff changeset
935 *yank r
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18825
diff changeset
936 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
937
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18825
diff changeset
938 delmarks < >
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18825
diff changeset
939 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
940 close!
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18825
diff changeset
941 endfunc
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18825
diff changeset
942
19613
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
943 " Test for using visual mode maps in select mode
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
944 func Test_select_mode_map()
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
945 new
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
946 vmap <buffer> <F2> 3l
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
947 call setline(1, 'Test line')
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
948 call feedkeys("gh\<F2>map", 'xt')
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
949 call assert_equal('map line', getline(1))
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
950
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
951 vmap <buffer> <F2> ygV
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
952 call feedkeys("0gh\<Right>\<Right>\<F2>cwabc", 'xt')
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
953 call assert_equal('abc line', getline(1))
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
954
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
955 vmap <buffer> <F2> :<C-U>let v=100<CR>
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
956 call feedkeys("gggh\<Right>\<Right>\<F2>foo", 'xt')
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
957 call assert_equal('foo line', getline(1))
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
958
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
959 " reselect the select mode using gv from a visual mode map
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
960 vmap <buffer> <F2> gv
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
961 set selectmode=cmd
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
962 call feedkeys("0gh\<F2>map", 'xt')
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
963 call assert_equal('map line', getline(1))
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
964 set selectmode&
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
965
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
966 close!
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
967 endfunc
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
968
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
969 " 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
970 func Test_exclusive_selection()
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
971 new
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
972 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
973 set selection=exclusive
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
974 call feedkeys("vwcabc", 'xt')
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
975 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
976 call setline(1, ["\tone"])
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
977 set virtualedit=all
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
978 call feedkeys('0v2lcl', 'xt')
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
979 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
980 set virtualedit&
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
981 set selection&
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
982 close!
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
983 endfunc
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
984
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
985 " Test for starting visual mode with a count.
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
986 " This test should be run without any previous visual modes. So this should be
19613
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
987 " run as a first test.
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
988 func Test_AAA_start_visual_mode_with_count()
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
989 new
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
990 call setline(1, ['aaaaaaa', 'aaaaaaa', 'aaaaaaa', 'aaaaaaa'])
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
991 normal! gg2Vy
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
992 call assert_equal("aaaaaaa\naaaaaaa\n", @")
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
993 close!
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
994 endfunc
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
995
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
996 " vim: shiftwidth=2 sts=2 expandtab