xref: /vim-8.2.3635/src/testdir/test_visual.vim (revision e16b00a1)
1" Tests for various Visual mode.
2if !has('visual')
3  finish
4endif
5
6set belloff=all
7
8func Test_block_shift_multibyte()
9  " Uses double-wide character.
10  if !has('multi_byte')
11    return
12  endif
13  split
14  call setline(1, ['xヹxxx', 'ヹxxx'])
15  exe "normal 1G0l\<C-V>jl>"
16  call assert_equal('x	 ヹxxx', getline(1))
17  call assert_equal('	ヹxxx', getline(2))
18  q!
19endfunc
20
21func Test_block_shift_overflow()
22  " This used to cause a multiplication overflow followed by a crash.
23  new
24  normal ii
25  exe "normal \<C-V>876543210>"
26  q!
27endfunc
28
29func Test_dotregister_paste()
30  new
31  exe "norm! ihello world\<esc>"
32  norm! 0ve".p
33  call assert_equal('hello world world', getline(1))
34  q!
35endfunc
36
37func Test_Visual_ctrl_o()
38  new
39  call setline(1, ['one', 'two', 'three'])
40  call cursor(1,2)
41  set noshowmode
42  set tw=0
43  call feedkeys("\<c-v>jjlIa\<c-\>\<c-o>:set tw=88\<cr>\<esc>", 'tx')
44  call assert_equal(['oane', 'tawo', 'tahree'], getline(1, 3))
45  call assert_equal(88, &tw)
46  set tw&
47  bw!
48endfu
49
50func Test_Visual_vapo()
51  new
52  normal oxx
53  normal vapo
54  bwipe!
55endfunc
56
57func Test_Visual_inner_quote()
58  new
59  normal oxX
60  normal vki'
61  bwipe!
62endfunc
63