annotate src/testdir/test_visual.vim @ 13402:338b15c63e2c v8.0.1575

patch 8.0.1575: crash when using virtual replace commit https://github.com/vim/vim/commit/63e82db6fc910b2d8f1cd018894e50e8b4448155 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Mar 6 12:10:48 2018 +0100 patch 8.0.1575: crash when using virtual replace Problem: Crash when using virtual replace. Solution: Adjust orig_line_count. Add more tests. (Christian Brabandt)
author Christian Brabandt <cb@256bit.org>
date Tue, 06 Mar 2018 12:15:05 +0100
parents aa658b33f25a
children 4e30f3f4cb78
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10494
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
1 " Tests for various Visual mode.
8401
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2 if !has('visual')
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 finish
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 endif
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5
11091
ae45d497868f patch 8.0.0433: beeps when running tests
Christian Brabandt <cb@256bit.org>
parents: 10900
diff changeset
6
8401
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 func Test_block_shift_multibyte()
10494
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
8 " Uses double-wide character.
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
9 if !has('multi_byte')
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
10 return
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
11 endif
8401
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 split
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 call setline(1, ['xヹxxx', 'ヹxxx'])
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 exe "normal 1G0l\<C-V>jl>"
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 call assert_equal('x ヹxxx', getline(1))
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 call assert_equal(' ヹxxx', getline(2))
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 q!
98955c2ffd9f commit https://github.com/vim/vim/commit/019b9c644e92742e37efc08fef47c2620a01b6b3
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 endfunc
10494
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
19
11997
66b677c77467 patch 8.0.0879: crash when shifting with huge number
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
20 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
21 " 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
22 new
66b677c77467 patch 8.0.0879: crash when shifting with huge number
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
23 normal ii
66b677c77467 patch 8.0.0879: crash when shifting with huge number
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
24 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
25 q!
66b677c77467 patch 8.0.0879: crash when shifting with huge number
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
26 endfunc
66b677c77467 patch 8.0.0879: crash when shifting with huge number
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
27
10494
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
28 func Test_dotregister_paste()
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
29 new
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
30 exe "norm! ihello world\<esc>"
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
31 norm! 0ve".p
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
32 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
33 q!
1e700d72561d commit https://github.com/vim/vim/commit/f8eb9c51e5bbd10e59c9b1247f8f6c7f5b77ccd0
Christian Brabandt <cb@256bit.org>
parents: 9618
diff changeset
34 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
35
065da86ca6d2 patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents: 10494
diff changeset
36 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
37 new
065da86ca6d2 patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents: 10494
diff changeset
38 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
39 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
40 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
41 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
42 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
43 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
44 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
45 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
46 bw!
065da86ca6d2 patch 8.0.0291: Visual block insertion does not insert in all lines
Christian Brabandt <cb@256bit.org>
parents: 10494
diff changeset
47 endfu
10881
8f6df2f6d2fc patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents: 10803
diff changeset
48
8f6df2f6d2fc patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents: 10803
diff changeset
49 func Test_Visual_vapo()
8f6df2f6d2fc patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents: 10803
diff changeset
50 new
8f6df2f6d2fc patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents: 10803
diff changeset
51 normal oxx
8f6df2f6d2fc patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents: 10803
diff changeset
52 normal vapo
8f6df2f6d2fc patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents: 10803
diff changeset
53 bwipe!
8f6df2f6d2fc patch 8.0.0330: illegal memory access after "vapo"
Christian Brabandt <cb@256bit.org>
parents: 10803
diff changeset
54 endfunc
10900
9b4574d95571 patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents: 10881
diff changeset
55
9b4574d95571 patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents: 10881
diff changeset
56 func Test_Visual_inner_quote()
9b4574d95571 patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents: 10881
diff changeset
57 new
9b4574d95571 patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents: 10881
diff changeset
58 normal oxX
9b4574d95571 patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents: 10881
diff changeset
59 normal vki'
9b4574d95571 patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents: 10881
diff changeset
60 bwipe!
9b4574d95571 patch 8.0.0339: illegal memory access with vi'
Christian Brabandt <cb@256bit.org>
parents: 10881
diff changeset
61 endfunc
12019
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
62
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
63 " 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
64 func TriggerTheProblem()
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
65 " 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
66 " Let's restore the selection:
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
67 normal gv
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
68 '<,'>del _
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
69 try
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
70 exe "normal \<Esc>"
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
71 catch /^Vim\%((\a\+)\)\=:E315/
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
72 echom 'Snap! E315 error!'
13402
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
73 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
74 endtry
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
75 endfunc
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 func Test_visual_mode_reset()
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
78 enew
13402
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
79 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
80 enew
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
81 setl buftype=nofile
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
82 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
83
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
84 " 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
85 " 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
86 " thus preventing the problem:
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
87 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
88 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
89
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11997
diff changeset
90 endfunc
12644
1fad9675d8fd patch 8.0.1200: tests switch the bell off twice
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
91
12686
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
92 " 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
93 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
94 enew!
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
95 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
96 call cursor(1,1)
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
97 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
98 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
99 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
100 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
101 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
102
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
103 enew!
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
104 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
105 call cursor(1,1)
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
106 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
107 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
108 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
109 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
110 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
111 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
112 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
113 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
114 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
115
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
116 %s/\s\+//g
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
117 call cursor(1,1)
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
118 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
119 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
120 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
121 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
122 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
123 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
124 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
125 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
126 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
127
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
128 enew!
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
129 endfunc
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 " 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
132 func Test_blockwise_visual()
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
133 enew!
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
134 call append(0, ['123456',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
135 \ '234567',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
136 \ '345678',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
137 \ '',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
138 \ '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
139 \ "\t\tsome text",
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
140 \ "\t\ttest text",
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
141 \ 'test text'])
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
142 call cursor(1,1)
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
143 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
144 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
145 exe "normal /456$\<CR>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
146 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
147 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
148 \ '234start here67',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
149 \ '345start here78',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
150 \ '',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
151 \ '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
152 \ "\t\tsomext",
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
153 \ "\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
154
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
155 enew!
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
156 endfunc
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
157
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
158 " Test Virtual replace mode.
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
159 func Test_virtual_replace()
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
160 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
161 enew!
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
162 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
163 call cursor(1,1)
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
164 set ai bs=2
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
165 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
166 call assert_equal([' 1',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
167 \ ' A',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
168 \ ' BCDEFGHIJ',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
169 \ ' KL',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
170 \ ' MNO',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
171 \ ' PQR',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
172 \ ], getline(1, 6))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
173 normal G
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
174 mark a
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
175 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
176 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
177 call assert_equal([' 1',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
178 \ 'abcdefghi',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
179 \ 'jk lmn',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
180 \ ' opq rst',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
181 \ 'uvwxyz'], getline(7, 11))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
182 normal G
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
183 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
184 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
185 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
186 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
187 \ '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
188 enew!
13402
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
189 set noai bs&vim t_kD&vim t_kb&vim
12686
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
190 endfunc
13402
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
191
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
192 " Test Virtual replace mode.
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
193 func Test_virtual_replace2()
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
194 enew!
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
195 set bs=2
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
196 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
197 call cursor(1,1)
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
198 " 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
199 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
200 call assert_equal(['0 1',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
201 \ 'A',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
202 \ 'BCDEFGHIJ',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
203 \ ' KL',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
204 \ 'MNO',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
205 \ 'PQR',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
206 \ ], getline(1, 6))
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
207 " Test 2:
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
208 " 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
209 %d_
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
210 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
211 call cursor(2,1)
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
212 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
213 call assert_equal(['abcd',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
214 \ '123h',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
215 \ 'ijkl'], getline(1, '$'))
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
216 " Test 3:
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
217 " 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
218 %d_
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
219 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
220 call cursor(2,1)
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
221 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
222 call assert_equal(['abcd',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
223 \ '1234',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
224 \ 'ijkl'], getline(1, '$'))
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
225 " Test 4:
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
226 " 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
227 %d_
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
228 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
229 call cursor(2,1)
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
230 " break undo sequence explicitly
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
231 let &ul = &ul
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
232 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
233 let &ul = &ul
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
234 call assert_equal(['abcd',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
235 \ '123456',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
236 \ ''], getline(1, '$'))
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
237 norm! u
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
238 call assert_equal(['abcd',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
239 \ 'efgh',
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
240 \ 'ijkl'], getline(1, '$'))
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
241 " clean up
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
242 %d_
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
243 set bs&vim
338b15c63e2c patch 8.0.1575: crash when using virtual replace
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
244 endfunc