annotate src/testdir/test_virtualedit.vim @ 34618:7ff3c277377f v9.1.0198

patch 9.1.0198: Vim9: compound operators broken for lambdas in an object Commit: https://github.com/vim/vim/commit/d990bf08d85d83e14fc51fd99a66ebe2f36d2fcd Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Fri Mar 22 19:56:17 2024 +0100 patch 9.1.0198: Vim9: compound operators broken for lambdas in an object Problem: Vim9: compound operators broken for lambdas in an object (girishji) Solution: When using an object from the outer scope, use the LOADOUTER instruction to load the object (Yegappan Lakshmanan). fixes: #14236 closes: #14266 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Fri, 22 Mar 2024 20:00:06 +0100
parents df8faa0124f7
children c729852bfc19
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12164
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for 'virtualedit'.
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 func Test_yank_move_change()
12279
57e0b701611e patch 8.0.1019: pasting in virtual edit happens in the wrong place
Christian Brabandt <cb@256bit.org>
parents: 12164
diff changeset
4 new
12164
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 call setline(1, [
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 \ "func foo() error {",
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 \ "\tif n, err := bar();",
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 \ "\terr != nil {",
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 \ "\t\treturn err",
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 \ "\t}",
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 \ "\tn = n * n",
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 \ ])
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 set virtualedit=all
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 set ts=4
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 function! MoveSelectionDown(count) abort
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 normal! m`
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 silent! exe "'<,'>move'>+".a:count
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 norm! ``
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 endfunction
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 xmap ]e :<C-U>call MoveSelectionDown(v:count1)<CR>
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 2
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 normal 2gg
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 normal J
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 normal jVj
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 normal ]e
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 normal ce
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 bwipe!
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 set virtualedit=
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 set ts=8
5d82470552ce patch 8.0.0962: crash with virtualedit and joining lines
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 endfunc
12279
57e0b701611e patch 8.0.1019: pasting in virtual edit happens in the wrong place
Christian Brabandt <cb@256bit.org>
parents: 12164
diff changeset
32
57e0b701611e patch 8.0.1019: pasting in virtual edit happens in the wrong place
Christian Brabandt <cb@256bit.org>
parents: 12164
diff changeset
33 func Test_paste_end_of_line()
57e0b701611e patch 8.0.1019: pasting in virtual edit happens in the wrong place
Christian Brabandt <cb@256bit.org>
parents: 12164
diff changeset
34 new
57e0b701611e patch 8.0.1019: pasting in virtual edit happens in the wrong place
Christian Brabandt <cb@256bit.org>
parents: 12164
diff changeset
35 set virtualedit=all
57e0b701611e patch 8.0.1019: pasting in virtual edit happens in the wrong place
Christian Brabandt <cb@256bit.org>
parents: 12164
diff changeset
36 call setline(1, ['456', '123'])
57e0b701611e patch 8.0.1019: pasting in virtual edit happens in the wrong place
Christian Brabandt <cb@256bit.org>
parents: 12164
diff changeset
37 normal! gg0"ay$
57e0b701611e patch 8.0.1019: pasting in virtual edit happens in the wrong place
Christian Brabandt <cb@256bit.org>
parents: 12164
diff changeset
38 exe "normal! 2G$lllA\<C-O>:normal! \"agP\r"
57e0b701611e patch 8.0.1019: pasting in virtual edit happens in the wrong place
Christian Brabandt <cb@256bit.org>
parents: 12164
diff changeset
39 call assert_equal('123456', getline(2))
57e0b701611e patch 8.0.1019: pasting in virtual edit happens in the wrong place
Christian Brabandt <cb@256bit.org>
parents: 12164
diff changeset
40
57e0b701611e patch 8.0.1019: pasting in virtual edit happens in the wrong place
Christian Brabandt <cb@256bit.org>
parents: 12164
diff changeset
41 bwipe!
57e0b701611e patch 8.0.1019: pasting in virtual edit happens in the wrong place
Christian Brabandt <cb@256bit.org>
parents: 12164
diff changeset
42 set virtualedit=
57e0b701611e patch 8.0.1019: pasting in virtual edit happens in the wrong place
Christian Brabandt <cb@256bit.org>
parents: 12164
diff changeset
43 endfunc
13786
0fa21ba32e21 patch 8.0.1765: CTRL-G j in Insert mode is incorrect when 'virtualedit' set
Christian Brabandt <cb@256bit.org>
parents: 12279
diff changeset
44
14216
12bdbf9f7e20 patch 8.1.0125: virtual edit replace with multi-byte fails at end of line
Christian Brabandt <cb@256bit.org>
parents: 13786
diff changeset
45 func Test_replace_end_of_line()
12bdbf9f7e20 patch 8.1.0125: virtual edit replace with multi-byte fails at end of line
Christian Brabandt <cb@256bit.org>
parents: 13786
diff changeset
46 new
12bdbf9f7e20 patch 8.1.0125: virtual edit replace with multi-byte fails at end of line
Christian Brabandt <cb@256bit.org>
parents: 13786
diff changeset
47 set virtualedit=all
12bdbf9f7e20 patch 8.1.0125: virtual edit replace with multi-byte fails at end of line
Christian Brabandt <cb@256bit.org>
parents: 13786
diff changeset
48 call setline(1, range(20))
12bdbf9f7e20 patch 8.1.0125: virtual edit replace with multi-byte fails at end of line
Christian Brabandt <cb@256bit.org>
parents: 13786
diff changeset
49 exe "normal! gg2jv10lr-"
12bdbf9f7e20 patch 8.1.0125: virtual edit replace with multi-byte fails at end of line
Christian Brabandt <cb@256bit.org>
parents: 13786
diff changeset
50 call assert_equal(["1", "-----------", "3"], getline(2,4))
15607
2dcaa860e3fc patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 14216
diff changeset
51 call setline(1, range(20))
2dcaa860e3fc patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 14216
diff changeset
52 exe "normal! gg2jv10lr\<c-k>hh"
2dcaa860e3fc patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 14216
diff changeset
53 call assert_equal(["1", "───────────", "3"], getline(2,4))
14216
12bdbf9f7e20 patch 8.1.0125: virtual edit replace with multi-byte fails at end of line
Christian Brabandt <cb@256bit.org>
parents: 13786
diff changeset
54
12bdbf9f7e20 patch 8.1.0125: virtual edit replace with multi-byte fails at end of line
Christian Brabandt <cb@256bit.org>
parents: 13786
diff changeset
55 bwipe!
12bdbf9f7e20 patch 8.1.0125: virtual edit replace with multi-byte fails at end of line
Christian Brabandt <cb@256bit.org>
parents: 13786
diff changeset
56 set virtualedit=
12bdbf9f7e20 patch 8.1.0125: virtual edit replace with multi-byte fails at end of line
Christian Brabandt <cb@256bit.org>
parents: 13786
diff changeset
57 endfunc
12bdbf9f7e20 patch 8.1.0125: virtual edit replace with multi-byte fails at end of line
Christian Brabandt <cb@256bit.org>
parents: 13786
diff changeset
58
13786
0fa21ba32e21 patch 8.0.1765: CTRL-G j in Insert mode is incorrect when 'virtualedit' set
Christian Brabandt <cb@256bit.org>
parents: 12279
diff changeset
59 func Test_edit_CTRL_G()
0fa21ba32e21 patch 8.0.1765: CTRL-G j in Insert mode is incorrect when 'virtualedit' set
Christian Brabandt <cb@256bit.org>
parents: 12279
diff changeset
60 new
0fa21ba32e21 patch 8.0.1765: CTRL-G j in Insert mode is incorrect when 'virtualedit' set
Christian Brabandt <cb@256bit.org>
parents: 12279
diff changeset
61 set virtualedit=insert
0fa21ba32e21 patch 8.0.1765: CTRL-G j in Insert mode is incorrect when 'virtualedit' set
Christian Brabandt <cb@256bit.org>
parents: 12279
diff changeset
62 call setline(1, ['123', '1', '12'])
0fa21ba32e21 patch 8.0.1765: CTRL-G j in Insert mode is incorrect when 'virtualedit' set
Christian Brabandt <cb@256bit.org>
parents: 12279
diff changeset
63 exe "normal! ggA\<c-g>jx\<c-g>jx"
0fa21ba32e21 patch 8.0.1765: CTRL-G j in Insert mode is incorrect when 'virtualedit' set
Christian Brabandt <cb@256bit.org>
parents: 12279
diff changeset
64 call assert_equal(['123', '1 x', '12 x'], getline(1,'$'))
0fa21ba32e21 patch 8.0.1765: CTRL-G j in Insert mode is incorrect when 'virtualedit' set
Christian Brabandt <cb@256bit.org>
parents: 12279
diff changeset
65
0fa21ba32e21 patch 8.0.1765: CTRL-G j in Insert mode is incorrect when 'virtualedit' set
Christian Brabandt <cb@256bit.org>
parents: 12279
diff changeset
66 set virtualedit=all
0fa21ba32e21 patch 8.0.1765: CTRL-G j in Insert mode is incorrect when 'virtualedit' set
Christian Brabandt <cb@256bit.org>
parents: 12279
diff changeset
67 %d_
0fa21ba32e21 patch 8.0.1765: CTRL-G j in Insert mode is incorrect when 'virtualedit' set
Christian Brabandt <cb@256bit.org>
parents: 12279
diff changeset
68 call setline(1, ['1', '12'])
0fa21ba32e21 patch 8.0.1765: CTRL-G j in Insert mode is incorrect when 'virtualedit' set
Christian Brabandt <cb@256bit.org>
parents: 12279
diff changeset
69 exe "normal! ggllix\<c-g>jx"
0fa21ba32e21 patch 8.0.1765: CTRL-G j in Insert mode is incorrect when 'virtualedit' set
Christian Brabandt <cb@256bit.org>
parents: 12279
diff changeset
70 call assert_equal(['1 x', '12x'], getline(1,'$'))
0fa21ba32e21 patch 8.0.1765: CTRL-G j in Insert mode is incorrect when 'virtualedit' set
Christian Brabandt <cb@256bit.org>
parents: 12279
diff changeset
71
0fa21ba32e21 patch 8.0.1765: CTRL-G j in Insert mode is incorrect when 'virtualedit' set
Christian Brabandt <cb@256bit.org>
parents: 12279
diff changeset
72
0fa21ba32e21 patch 8.0.1765: CTRL-G j in Insert mode is incorrect when 'virtualedit' set
Christian Brabandt <cb@256bit.org>
parents: 12279
diff changeset
73 bwipe!
0fa21ba32e21 patch 8.0.1765: CTRL-G j in Insert mode is incorrect when 'virtualedit' set
Christian Brabandt <cb@256bit.org>
parents: 12279
diff changeset
74 set virtualedit=
0fa21ba32e21 patch 8.0.1765: CTRL-G j in Insert mode is incorrect when 'virtualedit' set
Christian Brabandt <cb@256bit.org>
parents: 12279
diff changeset
75 endfunc
18481
26256dcadd77 patch 8.1.2235: "C" with 'virtualedit' set does not include multi-byte char
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
76
26256dcadd77 patch 8.1.2235: "C" with 'virtualedit' set does not include multi-byte char
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
77 func Test_edit_change()
26256dcadd77 patch 8.1.2235: "C" with 'virtualedit' set does not include multi-byte char
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
78 new
26256dcadd77 patch 8.1.2235: "C" with 'virtualedit' set does not include multi-byte char
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
79 set virtualedit=all
34418
df8faa0124f7 patch 9.1.0132: "C" doesn't include composing chars with 'virtualedit'
Christian Brabandt <cb@256bit.org>
parents: 33347
diff changeset
80
18481
26256dcadd77 patch 8.1.2235: "C" with 'virtualedit' set does not include multi-byte char
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
81 call setline(1, "\t⒌")
26256dcadd77 patch 8.1.2235: "C" with 'virtualedit' set does not include multi-byte char
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
82 normal Cx
26256dcadd77 patch 8.1.2235: "C" with 'virtualedit' set does not include multi-byte char
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
83 call assert_equal('x', getline(1))
34418
df8faa0124f7 patch 9.1.0132: "C" doesn't include composing chars with 'virtualedit'
Christian Brabandt <cb@256bit.org>
parents: 33347
diff changeset
84
df8faa0124f7 patch 9.1.0132: "C" doesn't include composing chars with 'virtualedit'
Christian Brabandt <cb@256bit.org>
parents: 33347
diff changeset
85 call setline(1, "\ta̳")
df8faa0124f7 patch 9.1.0132: "C" doesn't include composing chars with 'virtualedit'
Christian Brabandt <cb@256bit.org>
parents: 33347
diff changeset
86 normal Cx
df8faa0124f7 patch 9.1.0132: "C" doesn't include composing chars with 'virtualedit'
Christian Brabandt <cb@256bit.org>
parents: 33347
diff changeset
87 call assert_equal('x', getline(1))
df8faa0124f7 patch 9.1.0132: "C" doesn't include composing chars with 'virtualedit'
Christian Brabandt <cb@256bit.org>
parents: 33347
diff changeset
88
df8faa0124f7 patch 9.1.0132: "C" doesn't include composing chars with 'virtualedit'
Christian Brabandt <cb@256bit.org>
parents: 33347
diff changeset
89 call setline(1, "\tβ̳")
df8faa0124f7 patch 9.1.0132: "C" doesn't include composing chars with 'virtualedit'
Christian Brabandt <cb@256bit.org>
parents: 33347
diff changeset
90 normal Cx
df8faa0124f7 patch 9.1.0132: "C" doesn't include composing chars with 'virtualedit'
Christian Brabandt <cb@256bit.org>
parents: 33347
diff changeset
91 call assert_equal('x', getline(1))
df8faa0124f7 patch 9.1.0132: "C" doesn't include composing chars with 'virtualedit'
Christian Brabandt <cb@256bit.org>
parents: 33347
diff changeset
92
df8faa0124f7 patch 9.1.0132: "C" doesn't include composing chars with 'virtualedit'
Christian Brabandt <cb@256bit.org>
parents: 33347
diff changeset
93 if has('arabic')
df8faa0124f7 patch 9.1.0132: "C" doesn't include composing chars with 'virtualedit'
Christian Brabandt <cb@256bit.org>
parents: 33347
diff changeset
94 call setline(1, "\tلا")
df8faa0124f7 patch 9.1.0132: "C" doesn't include composing chars with 'virtualedit'
Christian Brabandt <cb@256bit.org>
parents: 33347
diff changeset
95 normal Cx
df8faa0124f7 patch 9.1.0132: "C" doesn't include composing chars with 'virtualedit'
Christian Brabandt <cb@256bit.org>
parents: 33347
diff changeset
96 call assert_equal('x', getline(1))
df8faa0124f7 patch 9.1.0132: "C" doesn't include composing chars with 'virtualedit'
Christian Brabandt <cb@256bit.org>
parents: 33347
diff changeset
97 endif
df8faa0124f7 patch 9.1.0132: "C" doesn't include composing chars with 'virtualedit'
Christian Brabandt <cb@256bit.org>
parents: 33347
diff changeset
98
24725
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
99 " Do a visual block change
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
100 call setline(1, ['a', 'b', 'c'])
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
101 exe "normal gg3l\<C-V>2jcx"
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
102 call assert_equal(['a x', 'b x', 'c x'], getline(1, '$'))
34418
df8faa0124f7 patch 9.1.0132: "C" doesn't include composing chars with 'virtualedit'
Christian Brabandt <cb@256bit.org>
parents: 33347
diff changeset
103
18481
26256dcadd77 patch 8.1.2235: "C" with 'virtualedit' set does not include multi-byte char
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
104 bwipe!
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
105 set virtualedit=
18481
26256dcadd77 patch 8.1.2235: "C" with 'virtualedit' set does not include multi-byte char
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
106 endfunc
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
107
32094
7d94b1c0f292 patch 9.0.1378: illegal memory access when using virtual editing
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
108 func Test_edit_special_char()
7d94b1c0f292 patch 9.0.1378: illegal memory access when using virtual editing
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
109 new
7d94b1c0f292 patch 9.0.1378: illegal memory access when using virtual editing
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
110 se ve=all
7d94b1c0f292 patch 9.0.1378: illegal memory access when using virtual editing
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
111 norm a0
7d94b1c0f292 patch 9.0.1378: illegal memory access when using virtual editing
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
112 sil! exe "norm o00000\<Nul>k<a0s"
7d94b1c0f292 patch 9.0.1378: illegal memory access when using virtual editing
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
113
7d94b1c0f292 patch 9.0.1378: illegal memory access when using virtual editing
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
114 bwipe!
7d94b1c0f292 patch 9.0.1378: illegal memory access when using virtual editing
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
115 set virtualedit=
7d94b1c0f292 patch 9.0.1378: illegal memory access when using virtual editing
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
116 endfunc
7d94b1c0f292 patch 9.0.1378: illegal memory access when using virtual editing
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
117
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
118 " Tests for pasting at the beginning, end and middle of a tab character
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
119 " in virtual edit mode.
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
120 func Test_paste_in_tab()
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
121 new
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
122 call append(0, '')
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
123 set virtualedit=all
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
124
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
125 " Tests for pasting a register with characterwise mode type
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
126 call setreg('"', 'xyz', 'c')
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
127
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
128 " paste (p) unnamed register at the beginning of a tab
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
129 call setline(1, "a\tb")
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
130 call cursor(1, 2, 0)
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
131 normal p
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
132 call assert_equal('a xyz b', getline(1))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
133
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
134 " paste (P) unnamed register at the beginning of a tab
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
135 call setline(1, "a\tb")
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
136 call cursor(1, 2, 0)
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
137 normal P
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
138 call assert_equal("axyz\tb", getline(1))
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
139
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
140 " paste (p) unnamed register at the end of a tab
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
141 call setline(1, "a\tb")
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
142 call cursor(1, 2, 6)
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
143 normal p
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
144 call assert_equal("a\txyzb", getline(1))
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
145
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
146 " paste (P) unnamed register at the end of a tab
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
147 call setline(1, "a\tb")
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
148 call cursor(1, 2, 6)
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
149 normal P
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
150 call assert_equal('a xyz b', getline(1))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
151
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
152 " Tests for pasting a register with blockwise mode type
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
153 call setreg('"', 'xyz', 'b')
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
154
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
155 " paste (p) unnamed register at the beginning of a tab
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
156 call setline(1, "a\tb")
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
157 call cursor(1, 2, 0)
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
158 normal p
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
159 call assert_equal('a xyz b', getline(1))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
160
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
161 " paste (P) unnamed register at the beginning of a tab
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
162 call setline(1, "a\tb")
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
163 call cursor(1, 2, 0)
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
164 normal P
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
165 call assert_equal("axyz\tb", getline(1))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
166
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
167 " paste (p) unnamed register at the end of a tab
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
168 call setline(1, "a\tb")
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
169 call cursor(1, 2, 6)
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
170 normal p
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
171 call assert_equal("a\txyzb", getline(1))
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
172
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
173 " paste (P) unnamed register at the end of a tab
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
174 call setline(1, "a\tb")
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
175 call cursor(1, 2, 6)
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
176 normal P
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
177 call assert_equal('a xyz b', getline(1))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
178
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
179 " Tests for pasting with gp and gP in virtual edit mode
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
180
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
181 " paste (gp) unnamed register at the beginning of a tab
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
182 call setline(1, "a\tb")
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
183 call cursor(1, 2, 0)
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
184 normal gp
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
185 call assert_equal('a xyz b', getline(1))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
186 call assert_equal([0, 1, 12, 0, 12], getcurpos())
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
187
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
188 " paste (gP) unnamed register at the beginning of a tab
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
189 call setline(1, "a\tb")
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
190 call cursor(1, 2, 0)
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
191 normal gP
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
192 call assert_equal("axyz\tb", getline(1))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
193 call assert_equal([0, 1, 5, 0, 5], getcurpos())
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
194
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
195 " paste (gp) unnamed register at the end of a tab
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
196 call setline(1, "a\tb")
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
197 call cursor(1, 2, 6)
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
198 normal gp
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
199 call assert_equal("a\txyzb", getline(1))
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
200 call assert_equal([0, 1, 6, 0, 12], getcurpos())
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
201
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
202 " paste (gP) unnamed register at the end of a tab
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
203 call setline(1, "a\tb")
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
204 call cursor(1, 2, 6)
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
205 normal gP
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
206 call assert_equal('a xyz b', getline(1))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
207 call assert_equal([0, 1, 12, 0, 12], getcurpos())
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
208
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
209 " Tests for pasting a named register
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
210 let @r = 'xyz'
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
211
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
212 " paste (gp) named register in the middle of a tab
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
213 call setline(1, "a\tb")
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
214 call cursor(1, 2, 2)
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
215 normal "rgp
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
216 call assert_equal('a xyz b', getline(1))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
217 call assert_equal([0, 1, 8, 0, 8], getcurpos())
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
218
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
219 " paste (gP) named register in the middle of a tab
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
220 call setline(1, "a\tb")
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
221 call cursor(1, 2, 2)
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
222 normal "rgP
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
223 call assert_equal('a xyz b', getline(1))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
224 call assert_equal([0, 1, 7, 0, 7], getcurpos())
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
225
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
226 bwipe!
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
227 set virtualedit=
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
228 endfunc
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
229
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
230 " Test for yanking a few spaces within a tab to a register
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
231 func Test_yank_in_tab()
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
232 new
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
233 let @r = ''
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
234 call setline(1, "a\tb")
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
235 set virtualedit=all
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
236 call cursor(1, 2, 2)
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
237 normal "ry5l
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
238 call assert_equal(' ', @r)
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
239
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
240 bwipe!
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
241 set virtualedit=
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
242 endfunc
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
243
18791
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
244 " Insert "keyword keyw", ESC, C CTRL-N, shows "keyword ykeyword".
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
245 " Repeating CTRL-N fixes it. (Mary Ellen Foster)
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
246 func Test_ve_completion()
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
247 new
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
248 set completeopt&vim
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
249 set virtualedit=all
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
250 exe "normal ikeyword keyw\<Esc>C\<C-N>"
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
251 call assert_equal('keyword keyword', getline(1))
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
252 bwipe!
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
253 set virtualedit=
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
254 endfunc
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
255
33223
def9fc5c92d1 patch 9.0.1886: Various Typos
Christian Brabandt <cb@256bit.org>
parents: 32824
diff changeset
256 " Using "C" then <CR> moves the last remaining character to the next
18791
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
257 " line. (Mary Ellen Foster)
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
258 func Test_ve_del_to_eol()
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
259 new
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
260 set virtualedit=all
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
261 call append(0, 'all your base are belong to us')
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
262 call search('are', 'w')
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
263 exe "normal C\<CR>are belong to vim"
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
264 call assert_equal(['all your base ', 'are belong to vim'], getline(1, 2))
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
265 bwipe!
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
266 set virtualedit=
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
267 endfunc
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
268
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
269 " When past the end of a line that ends in a single character "b" skips
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
270 " that word.
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
271 func Test_ve_b_past_eol()
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
272 new
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
273 set virtualedit=all
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
274 call append(0, '1 2 3 4 5 6')
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
275 normal gg^$15lbC7
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
276 call assert_equal('1 2 3 4 5 7', getline(1))
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
277 bwipe!
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
278 set virtualedit=
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
279 endfunc
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
280
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
281 " Make sure 'i', 'C', 'a', 'A' and 'D' works
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
282 func Test_ve_ins_del()
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
283 new
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
284 set virtualedit=all
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
285 call append(0, ["'i'", "'C'", "'a'", "'A'", "'D'"])
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
286 call cursor(1, 1)
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
287 normal $4lix
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
288 call assert_equal("'i' x", getline(1))
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
289 call cursor(2, 1)
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
290 normal $4lCx
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
291 call assert_equal("'C' x", getline(2))
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
292 call cursor(3, 1)
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
293 normal $4lax
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
294 call assert_equal("'a' x", getline(3))
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
295 call cursor(4, 1)
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
296 normal $4lAx
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
297 call assert_equal("'A'x", getline(4))
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
298 call cursor(5, 1)
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
299 normal $4lDix
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
300 call assert_equal("'D' x", getline(5))
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
301 bwipe!
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
302 set virtualedit=
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
303 endfunc
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
304
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
305 " Test for yank bug reported by Mark Waggoner.
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
306 func Test_yank_block()
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
307 new
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
308 set virtualedit=block
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
309 call append(0, repeat(['this is a test'], 3))
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
310 exe "normal gg^2w\<C-V>3jy"
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
311 call assert_equal("a\na\na\n ", @")
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
312 bwipe!
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
313 set virtualedit=
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
314 endfunc
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
315
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
316 " Test "r" beyond the end of the line
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
317 func Test_replace_after_eol()
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
318 new
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
319 set virtualedit=all
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
320 call append(0, '"r"')
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
321 normal gg$5lrxa
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
322 call assert_equal('"r" x', getline(1))
24725
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
323 " visual block replace
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
324 %d _
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
325 call setline(1, ['a', '', 'b'])
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
326 exe "normal 2l\<C-V>2jrx"
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
327 call assert_equal(['a x', ' x', 'b x'], getline(1, '$'))
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
328 " visual characterwise selection replace after eol
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
329 %d _
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
330 call setline(1, 'a')
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
331 normal 4lv2lrx
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
332 call assert_equal('a xxx', getline(1))
18791
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
333 bwipe!
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
334 set virtualedit=
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
335 endfunc
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
336
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
337 " Test "r" on a tab
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
338 " Note that for this test, 'ts' must be 8 (the default).
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
339 func Test_replace_on_tab()
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
340 new
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
341 set virtualedit=all
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
342 call append(0, "'r'\t")
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
343 normal gg^5lrxAy
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
344 call assert_equal("'r' x y", getline(1))
19613
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 18791
diff changeset
345 call setline(1, 'aaaaaaaaaaaa')
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 18791
diff changeset
346 exe "normal! gg2lgR\<Tab>"
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 18791
diff changeset
347 call assert_equal("aa\taaaa", getline(1))
18791
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
348 bwipe!
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
349 set virtualedit=
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
350 endfunc
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
351
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
352 " Test to make sure 'x' can delete control characters
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
353 func Test_ve_del_ctrl_chars()
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
354 new
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
355 set virtualedit=all
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
356 call append(0, "a\<C-V>b\<CR>sd")
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
357 set display=uhex
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
358 normal gg^xxxxxxi[text]
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
359 set display=
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
360 call assert_equal('[text]', getline(1))
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
361 bwipe!
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
362 set virtualedit=
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
363 endfunc
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
364
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
365 " Test for ^Y/^E due to bad w_virtcol value, reported by
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
366 " Roy <royl@netropolis.net>.
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
367 func Test_ins_copy_char()
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
368 new
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
369 set virtualedit=all
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
370 call append(0, 'abcv8efi.him2kl')
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
371 exe "normal gg^O\<Esc>3li\<C-E>\<Esc>4li\<C-E>\<Esc>4li\<C-E> <--"
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
372 exe "normal j^o\<Esc>4li\<C-Y>\<Esc>4li\<C-Y>\<Esc>4li\<C-Y> <--"
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
373 call assert_equal(' v i m <--', getline(1))
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
374 call assert_equal(' 8 . 2 <--', getline(3))
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
375 bwipe!
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
376 set virtualedit=
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
377 endfunc
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
378
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
379 " Test for yanking and pasting using the small delete register
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
380 func Test_yank_paste_small_del_reg()
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
381 new
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
382 set virtualedit=all
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
383 call append(0, "foo, bar")
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
384 normal ggdewve"-p
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
385 call assert_equal(', foo', getline(1))
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
386 bwipe!
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
387 set virtualedit=
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
388 endfunc
f966b20bb74d patch 8.1.2384: test 48 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
389
19969
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
390 " Test for delete that breaks a tab into spaces
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
391 func Test_delete_break_tab()
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
392 new
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
393 call setline(1, "one\ttwo")
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
394 set virtualedit=all
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
395 normal v3ld
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
396 call assert_equal(' two', getline(1))
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
397 set virtualedit&
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
398 close!
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
399 endfunc
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
400
20941
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
401 " Test for using <BS>, <C-W> and <C-U> in virtual edit mode
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
402 " to erase character, word and line.
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
403 func Test_ve_backspace()
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
404 new
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
405 call setline(1, 'sample')
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
406 set virtualedit=all
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
407 set backspace=indent,eol,start
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
408 exe "normal 15|i\<BS>\<BS>"
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
409 call assert_equal([0, 1, 7, 5], getpos('.'))
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
410 exe "normal 15|i\<C-W>"
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
411 call assert_equal([0, 1, 6, 0], getpos('.'))
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
412 exe "normal 15|i\<C-U>"
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
413 call assert_equal([0, 1, 1, 0], getpos('.'))
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
414 set backspace&
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
415 set virtualedit&
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
416 close!
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
417 endfunc
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
418
24725
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
419 " Test for delete (x) on EOL character and after EOL
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
420 func Test_delete_past_eol()
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
421 new
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
422 call setline(1, "ab")
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
423 set virtualedit=all
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
424 exe "normal 2lx"
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
425 call assert_equal('ab', getline(1))
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
426 exe "normal 10lx"
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
427 call assert_equal('ab', getline(1))
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
428 set virtualedit&
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
429 bw!
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
430 endfunc
3cdbce5ba73f patch 8.2.2901: some operators not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
431
25380
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
432 " After calling s:TryVirtualeditReplace(), line 1 will contain one of these
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
433 " two strings, depending on whether virtual editing is on or off.
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
434 let s:result_ve_on = 'a x'
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
435 let s:result_ve_off = 'x'
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
436
25487
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
437 " Utility function for Test_global_local_virtualedit()
25380
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
438 func s:TryVirtualeditReplace()
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
439 call setline(1, 'a')
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
440 normal gg7l
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
441 normal rx
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
442 endfunc
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
443
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
444 " Test for :set and :setlocal
25487
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
445 func Test_global_local_virtualedit()
25380
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
446 new
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
447
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
448 " Verify that 'virtualedit' is initialized to empty, can be set globally to
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
449 " all and to empty, and can be set locally to all and to empty.
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
450 call s:TryVirtualeditReplace()
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
451 call assert_equal(s:result_ve_off, getline(1))
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
452 set ve=all
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
453 call s:TryVirtualeditReplace()
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
454 call assert_equal(s:result_ve_on, getline(1))
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
455 set ve=
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
456 call s:TryVirtualeditReplace()
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
457 call assert_equal(s:result_ve_off, getline(1))
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
458 setlocal ve=all
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
459 call s:TryVirtualeditReplace()
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
460 call assert_equal(s:result_ve_on, getline(1))
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
461 setlocal ve=
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
462 call s:TryVirtualeditReplace()
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
463 call assert_equal(s:result_ve_off, getline(1))
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
464
25487
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
465 " Verify that :set affects multiple windows.
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
466 split
25380
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
467 set ve=all
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
468 call s:TryVirtualeditReplace()
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
469 call assert_equal(s:result_ve_on, getline(1))
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
470 wincmd p
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
471 call s:TryVirtualeditReplace()
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
472 call assert_equal(s:result_ve_on, getline(1))
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
473 set ve=
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
474 wincmd p
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
475 call s:TryVirtualeditReplace()
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
476 call assert_equal(s:result_ve_off, getline(1))
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
477 bwipe!
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
478
25487
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
479 " Verify that :setlocal affects only the current window.
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
480 new
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
481 split
25380
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
482 setlocal ve=all
25487
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
483 call s:TryVirtualeditReplace()
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
484 call assert_equal(s:result_ve_on, getline(1))
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
485 wincmd p
25380
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
486 call s:TryVirtualeditReplace()
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
487 call assert_equal(s:result_ve_off, getline(1))
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
488 bwipe!
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
489 call s:TryVirtualeditReplace()
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
490 call assert_equal(s:result_ve_off, getline(1))
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
491
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
492 " Verify that the buffer 'virtualedit' state follows the global value only
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
493 " when empty and that "none" works as expected.
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
494 "
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
495 " 'virtualedit' State
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
496 " +--------+--------------------------+
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
497 " | Local | Global |
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
498 " | | |
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
499 " +--------+--------+--------+--------+
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
500 " | | "" | "all" | "none" |
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
501 " +--------+--------+--------+--------+
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
502 " | "" | off | on | off |
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
503 " | "all" | on | on | on |
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
504 " | "none" | off | off | off |
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
505 " +--------+--------+--------+--------+
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
506 new
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
507
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
508 setglobal ve=
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
509 setlocal ve=
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
510 call s:TryVirtualeditReplace()
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
511 call assert_equal(s:result_ve_off, getline(1))
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
512 setlocal ve=all
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
513 call s:TryVirtualeditReplace()
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
514 call assert_equal(s:result_ve_on, getline(1))
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
515 setlocal ve=none
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
516 call s:TryVirtualeditReplace()
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
517 call assert_equal(s:result_ve_off, getline(1))
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
518
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
519 setglobal ve=all
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
520 setlocal ve=
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
521 call s:TryVirtualeditReplace()
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
522 call assert_equal(s:result_ve_on, getline(1))
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
523 setlocal ve=all
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
524 call s:TryVirtualeditReplace()
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
525 call assert_equal(s:result_ve_on, getline(1))
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
526 setlocal ve=none
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
527 call s:TryVirtualeditReplace()
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
528 call assert_equal(s:result_ve_off, getline(1))
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
529 setlocal ve=NONE
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
530 call s:TryVirtualeditReplace()
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
531 call assert_equal(s:result_ve_off, getline(1))
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
532
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
533 setglobal ve=none
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
534 setlocal ve=
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
535 call s:TryVirtualeditReplace()
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
536 call assert_equal(s:result_ve_off, getline(1))
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
537 setlocal ve=all
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
538 call s:TryVirtualeditReplace()
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
539 call assert_equal(s:result_ve_on, getline(1))
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
540 setlocal ve=none
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
541 call s:TryVirtualeditReplace()
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
542 call assert_equal(s:result_ve_off, getline(1))
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
543
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
544 bwipe!
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
545
25487
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
546 " Verify that the 'virtualedit' state is copied to new windows.
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
547 new
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
548 call s:TryVirtualeditReplace()
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
549 call assert_equal(s:result_ve_off, getline(1))
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
550 split
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
551 setlocal ve=all
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
552 call s:TryVirtualeditReplace()
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
553 call assert_equal(s:result_ve_on, getline(1))
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
554 split
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
555 call s:TryVirtualeditReplace()
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
556 call assert_equal(s:result_ve_on, getline(1))
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
557 setlocal ve=
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
558 split
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
559 call s:TryVirtualeditReplace()
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
560 call assert_equal(s:result_ve_off, getline(1))
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
561 bwipe!
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
562
25380
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
563 setlocal virtualedit&
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
564 set virtualedit&
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
565 endfunc
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 24725
diff changeset
566
31845
2ce8e7c4acf4 patch 9.0.1255: changing 'virtualedit' does not have immediate effect
Bram Moolenaar <Bram@vim.org>
parents: 30295
diff changeset
567 func Test_virtualedit_setlocal()
2ce8e7c4acf4 patch 9.0.1255: changing 'virtualedit' does not have immediate effect
Bram Moolenaar <Bram@vim.org>
parents: 30295
diff changeset
568 enew
2ce8e7c4acf4 patch 9.0.1255: changing 'virtualedit' does not have immediate effect
Bram Moolenaar <Bram@vim.org>
parents: 30295
diff changeset
569 setglobal virtualedit=all
2ce8e7c4acf4 patch 9.0.1255: changing 'virtualedit' does not have immediate effect
Bram Moolenaar <Bram@vim.org>
parents: 30295
diff changeset
570 setlocal virtualedit=all
2ce8e7c4acf4 patch 9.0.1255: changing 'virtualedit' does not have immediate effect
Bram Moolenaar <Bram@vim.org>
parents: 30295
diff changeset
571 normal! l
2ce8e7c4acf4 patch 9.0.1255: changing 'virtualedit' does not have immediate effect
Bram Moolenaar <Bram@vim.org>
parents: 30295
diff changeset
572 redraw
2ce8e7c4acf4 patch 9.0.1255: changing 'virtualedit' does not have immediate effect
Bram Moolenaar <Bram@vim.org>
parents: 30295
diff changeset
573 setlocal virtualedit=none
2ce8e7c4acf4 patch 9.0.1255: changing 'virtualedit' does not have immediate effect
Bram Moolenaar <Bram@vim.org>
parents: 30295
diff changeset
574 call assert_equal(1, wincol())
2ce8e7c4acf4 patch 9.0.1255: changing 'virtualedit' does not have immediate effect
Bram Moolenaar <Bram@vim.org>
parents: 30295
diff changeset
575
2ce8e7c4acf4 patch 9.0.1255: changing 'virtualedit' does not have immediate effect
Bram Moolenaar <Bram@vim.org>
parents: 30295
diff changeset
576 setlocal virtualedit&
2ce8e7c4acf4 patch 9.0.1255: changing 'virtualedit' does not have immediate effect
Bram Moolenaar <Bram@vim.org>
parents: 30295
diff changeset
577 set virtualedit&
2ce8e7c4acf4 patch 9.0.1255: changing 'virtualedit' does not have immediate effect
Bram Moolenaar <Bram@vim.org>
parents: 30295
diff changeset
578 endfunc
2ce8e7c4acf4 patch 9.0.1255: changing 'virtualedit' does not have immediate effect
Bram Moolenaar <Bram@vim.org>
parents: 30295
diff changeset
579
29674
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
580 func Test_virtualedit_mouse()
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
581 let save_mouse = &mouse
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
582 set mouse=a
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
583 set virtualedit=all
33307
cb447202030d patch 9.0.1919: Wrong curswant when clicking on empty line or with vsplits
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
584 botright new
cb447202030d patch 9.0.1919: Wrong curswant when clicking on empty line or with vsplits
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
585 let row = win_screenpos(0)[0]
cb447202030d patch 9.0.1919: Wrong curswant when clicking on empty line or with vsplits
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
586 20vsplit
cb447202030d patch 9.0.1919: Wrong curswant when clicking on empty line or with vsplits
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
587 wincmd p
29674
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
588
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
589 call setline(1, ["text\tword"])
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
590 redraw
33307
cb447202030d patch 9.0.1919: Wrong curswant when clicking on empty line or with vsplits
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
591 call test_setmouse(row, 21 + 4)
29674
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
592 call feedkeys("\<LeftMouse>", "xt")
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
593 call assert_equal([0, 1, 4, 0, 4], getcurpos())
33307
cb447202030d patch 9.0.1919: Wrong curswant when clicking on empty line or with vsplits
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
594 call test_setmouse(row, 21 + 5)
29674
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
595 call feedkeys("\<LeftMouse>", "xt")
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
596 call assert_equal([0, 1, 5, 0, 5], getcurpos())
33307
cb447202030d patch 9.0.1919: Wrong curswant when clicking on empty line or with vsplits
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
597 call test_setmouse(row, 21 + 6)
29674
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
598 call feedkeys("\<LeftMouse>", "xt")
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
599 call assert_equal([0, 1, 5, 1, 6], getcurpos())
33307
cb447202030d patch 9.0.1919: Wrong curswant when clicking on empty line or with vsplits
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
600 call test_setmouse(row, 21 + 7)
29674
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
601 call feedkeys("\<LeftMouse>", "xt")
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
602 call assert_equal([0, 1, 5, 2, 7], getcurpos())
33307
cb447202030d patch 9.0.1919: Wrong curswant when clicking on empty line or with vsplits
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
603 call test_setmouse(row, 21 + 8)
29674
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
604 call feedkeys("\<LeftMouse>", "xt")
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
605 call assert_equal([0, 1, 5, 3, 8], getcurpos())
33307
cb447202030d patch 9.0.1919: Wrong curswant when clicking on empty line or with vsplits
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
606 call test_setmouse(row, 21 + 9)
29674
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
607 call feedkeys("\<LeftMouse>", "xt")
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
608 call assert_equal([0, 1, 6, 0, 9], getcurpos())
33307
cb447202030d patch 9.0.1919: Wrong curswant when clicking on empty line or with vsplits
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
609 call test_setmouse(row, 21 + 12)
32824
22a08166a876 patch 9.0.1725: cursor pos wrong after concealed text with 'virtualedit'
Christian Brabandt <cb@256bit.org>
parents: 32094
diff changeset
610 call feedkeys("\<LeftMouse>", "xt")
22a08166a876 patch 9.0.1725: cursor pos wrong after concealed text with 'virtualedit'
Christian Brabandt <cb@256bit.org>
parents: 32094
diff changeset
611 call assert_equal([0, 1, 9, 0, 12], getcurpos())
33307
cb447202030d patch 9.0.1919: Wrong curswant when clicking on empty line or with vsplits
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
612 call test_setmouse(row, 21 + 13)
32824
22a08166a876 patch 9.0.1725: cursor pos wrong after concealed text with 'virtualedit'
Christian Brabandt <cb@256bit.org>
parents: 32094
diff changeset
613 call feedkeys("\<LeftMouse>", "xt")
22a08166a876 patch 9.0.1725: cursor pos wrong after concealed text with 'virtualedit'
Christian Brabandt <cb@256bit.org>
parents: 32094
diff changeset
614 call assert_equal([0, 1, 10, 0, 13], getcurpos())
33307
cb447202030d patch 9.0.1919: Wrong curswant when clicking on empty line or with vsplits
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
615 call test_setmouse(row, 21 + 15)
29674
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
616 call feedkeys("\<LeftMouse>", "xt")
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
617 call assert_equal([0, 1, 10, 2, 15], getcurpos())
33347
f47ee07ae029 patch 9.0.1937: missing test for mouse click + 'virtedit'
Christian Brabandt <cb@256bit.org>
parents: 33316
diff changeset
618 call test_setmouse(row, 21 + 20)
f47ee07ae029 patch 9.0.1937: missing test for mouse click + 'virtedit'
Christian Brabandt <cb@256bit.org>
parents: 33316
diff changeset
619 call feedkeys("\<LeftMouse>", "xt")
f47ee07ae029 patch 9.0.1937: missing test for mouse click + 'virtedit'
Christian Brabandt <cb@256bit.org>
parents: 33316
diff changeset
620 call assert_equal([0, 1, 10, 7, 20], getcurpos())
29674
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
621
33316
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
622 setlocal nowrap
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
623 call setline(2, repeat('a', 19))
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
624 normal! j14zl
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
625 redraw
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
626 call test_setmouse(row, 21 + 1)
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
627 call feedkeys("\<LeftMouse>", "xt")
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
628 call assert_equal([0, 1, 10, 2, 15], getcurpos())
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
629 call test_setmouse(row, 21 + 11)
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
630 call feedkeys("\<LeftMouse>", "xt")
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
631 call assert_equal([0, 1, 10, 12, 25], getcurpos())
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
632 call test_setmouse(row + 1, 21 + 1)
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
633 call feedkeys("\<LeftMouse>", "xt")
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
634 call assert_equal([0, 2, 15, 0, 15], getcurpos())
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
635 call test_setmouse(row + 1, 21 + 11)
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
636 call feedkeys("\<LeftMouse>", "xt")
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
637 call assert_equal([0, 2, 20, 5, 25], getcurpos())
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
638
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
639 setlocal number numberwidth=2
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
640 redraw
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
641 call test_setmouse(row, 21 + 3)
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
642 call feedkeys("\<LeftMouse>", "xt")
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
643 call assert_equal([0, 1, 10, 2, 15], getcurpos())
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
644 call test_setmouse(row, 21 + 13)
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
645 call feedkeys("\<LeftMouse>", "xt")
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
646 call assert_equal([0, 1, 10, 12, 25], getcurpos())
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
647 call test_setmouse(row + 1, 21 + 3)
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
648 call feedkeys("\<LeftMouse>", "xt")
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
649 call assert_equal([0, 2, 15, 0, 15], getcurpos())
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
650 call test_setmouse(row + 1, 21 + 13)
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
651 call feedkeys("\<LeftMouse>", "xt")
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
652 call assert_equal([0, 2, 20, 5, 25], getcurpos())
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
653 setlocal nonumber
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
654
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
655 if has('signs')
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
656 sign define Sign1 text=口
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
657 sign place 1 name=Sign1 line=1
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
658 sign place 2 name=Sign1 line=2
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
659 redraw
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
660 call test_setmouse(row, 21 + 3)
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
661 call feedkeys("\<LeftMouse>", "xt")
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
662 call assert_equal([0, 1, 10, 2, 15], getcurpos())
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
663 call test_setmouse(row, 21 + 13)
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
664 call feedkeys("\<LeftMouse>", "xt")
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
665 call assert_equal([0, 1, 10, 12, 25], getcurpos())
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
666 call test_setmouse(row + 1, 21 + 3)
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
667 call feedkeys("\<LeftMouse>", "xt")
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
668 call assert_equal([0, 2, 15, 0, 15], getcurpos())
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
669 call test_setmouse(row + 1, 21 + 13)
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
670 call feedkeys("\<LeftMouse>", "xt")
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
671 call assert_equal([0, 2, 20, 5, 25], getcurpos())
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
672 sign unplace 1
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
673 sign unplace 2
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
674 sign undefine Sign1
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
675 endif
a2dfcbbfc301 patch 9.0.1923: curswant wrong on click with 've' and 'wrap' set
Christian Brabandt <cb@256bit.org>
parents: 33307
diff changeset
676
33347
f47ee07ae029 patch 9.0.1937: missing test for mouse click + 'virtedit'
Christian Brabandt <cb@256bit.org>
parents: 33316
diff changeset
677 wincmd h
f47ee07ae029 patch 9.0.1937: missing test for mouse click + 'virtedit'
Christian Brabandt <cb@256bit.org>
parents: 33316
diff changeset
678 4wincmd >
f47ee07ae029 patch 9.0.1937: missing test for mouse click + 'virtedit'
Christian Brabandt <cb@256bit.org>
parents: 33316
diff changeset
679 normal! gg24I.
f47ee07ae029 patch 9.0.1937: missing test for mouse click + 'virtedit'
Christian Brabandt <cb@256bit.org>
parents: 33316
diff changeset
680 redraw
f47ee07ae029 patch 9.0.1937: missing test for mouse click + 'virtedit'
Christian Brabandt <cb@256bit.org>
parents: 33316
diff changeset
681 call test_setmouse(row + 1, 12)
f47ee07ae029 patch 9.0.1937: missing test for mouse click + 'virtedit'
Christian Brabandt <cb@256bit.org>
parents: 33316
diff changeset
682 call feedkeys("\<LeftMouse>", "xt")
f47ee07ae029 patch 9.0.1937: missing test for mouse click + 'virtedit'
Christian Brabandt <cb@256bit.org>
parents: 33316
diff changeset
683 call assert_equal([0, 1, 24 + 9, 0, 24 + 12], getcurpos())
f47ee07ae029 patch 9.0.1937: missing test for mouse click + 'virtedit'
Christian Brabandt <cb@256bit.org>
parents: 33316
diff changeset
684 call test_setmouse(row + 1, 13)
f47ee07ae029 patch 9.0.1937: missing test for mouse click + 'virtedit'
Christian Brabandt <cb@256bit.org>
parents: 33316
diff changeset
685 call feedkeys("\<LeftMouse>", "xt")
f47ee07ae029 patch 9.0.1937: missing test for mouse click + 'virtedit'
Christian Brabandt <cb@256bit.org>
parents: 33316
diff changeset
686 call assert_equal([0, 1, 24 + 10, 0, 24 + 13], getcurpos())
f47ee07ae029 patch 9.0.1937: missing test for mouse click + 'virtedit'
Christian Brabandt <cb@256bit.org>
parents: 33316
diff changeset
687 call test_setmouse(row + 1, 15)
f47ee07ae029 patch 9.0.1937: missing test for mouse click + 'virtedit'
Christian Brabandt <cb@256bit.org>
parents: 33316
diff changeset
688 call feedkeys("\<LeftMouse>", "xt")
f47ee07ae029 patch 9.0.1937: missing test for mouse click + 'virtedit'
Christian Brabandt <cb@256bit.org>
parents: 33316
diff changeset
689 call assert_equal([0, 1, 24 + 10, 2, 24 + 15], getcurpos())
f47ee07ae029 patch 9.0.1937: missing test for mouse click + 'virtedit'
Christian Brabandt <cb@256bit.org>
parents: 33316
diff changeset
690 call test_setmouse(row + 1, 20)
f47ee07ae029 patch 9.0.1937: missing test for mouse click + 'virtedit'
Christian Brabandt <cb@256bit.org>
parents: 33316
diff changeset
691 call feedkeys("\<LeftMouse>", "xt")
f47ee07ae029 patch 9.0.1937: missing test for mouse click + 'virtedit'
Christian Brabandt <cb@256bit.org>
parents: 33316
diff changeset
692 call assert_equal([0, 1, 24 + 10, 7, 24 + 20], getcurpos())
f47ee07ae029 patch 9.0.1937: missing test for mouse click + 'virtedit'
Christian Brabandt <cb@256bit.org>
parents: 33316
diff changeset
693
29674
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
694 bwipe!
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
695 let &mouse = save_mouse
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
696 set virtualedit&
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
697 endfunc
b11130c6e694 patch 9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
698
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
699 " this was replacing the NUL at the end of the line
30295
da023a22d73e patch 9.0.0483: illegal memory access when replacing in virtualedit mode
Bram Moolenaar <Bram@vim.org>
parents: 29674
diff changeset
700 func Test_virtualedit_replace_after_tab()
da023a22d73e patch 9.0.0483: illegal memory access when replacing in virtualedit mode
Bram Moolenaar <Bram@vim.org>
parents: 29674
diff changeset
701 new
da023a22d73e patch 9.0.0483: illegal memory access when replacing in virtualedit mode
Bram Moolenaar <Bram@vim.org>
parents: 29674
diff changeset
702 s/\v/ 0
da023a22d73e patch 9.0.0483: illegal memory access when replacing in virtualedit mode
Bram Moolenaar <Bram@vim.org>
parents: 29674
diff changeset
703 set ve=all
da023a22d73e patch 9.0.0483: illegal memory access when replacing in virtualedit mode
Bram Moolenaar <Bram@vim.org>
parents: 29674
diff changeset
704 let @" = ''
da023a22d73e patch 9.0.0483: illegal memory access when replacing in virtualedit mode
Bram Moolenaar <Bram@vim.org>
parents: 29674
diff changeset
705 sil! norm vPvr0
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
706
30295
da023a22d73e patch 9.0.0483: illegal memory access when replacing in virtualedit mode
Bram Moolenaar <Bram@vim.org>
parents: 29674
diff changeset
707 call assert_equal("\t0", getline(1))
da023a22d73e patch 9.0.0483: illegal memory access when replacing in virtualedit mode
Bram Moolenaar <Bram@vim.org>
parents: 29674
diff changeset
708 set ve&
da023a22d73e patch 9.0.0483: illegal memory access when replacing in virtualedit mode
Bram Moolenaar <Bram@vim.org>
parents: 29674
diff changeset
709 bwipe!
da023a22d73e patch 9.0.0483: illegal memory access when replacing in virtualedit mode
Bram Moolenaar <Bram@vim.org>
parents: 29674
diff changeset
710 endfunc
da023a22d73e patch 9.0.0483: illegal memory access when replacing in virtualedit mode
Bram Moolenaar <Bram@vim.org>
parents: 29674
diff changeset
711
da023a22d73e patch 9.0.0483: illegal memory access when replacing in virtualedit mode
Bram Moolenaar <Bram@vim.org>
parents: 29674
diff changeset
712
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
713 " vim: shiftwidth=2 sts=2 expandtab