annotate src/testdir/test_virtualedit.vim @ 18784:7b57a80f70f6 v8.1.2381

patch 8.1.2381: not all register related code is covered by tests Commit: https://github.com/vim/vim/commit/54c8d229f54e36e89fcd5d84e523fd894d018024 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Dec 2 20:41:39 2019 +0100 patch 8.1.2381: not all register related code is covered by tests Problem: Not all register related code is covered by tests. Solution: Add more test cases. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5301)
author Bram Moolenaar <Bram@vim.org>
date Mon, 02 Dec 2019 20:45:03 +0100
parents 50fde4e20790
children f966b20bb74d
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
26256dcadd77 patch 8.1.2235: "C" with 'virtualedit' set does not include multi-byte char
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
80 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
81 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
82 call assert_equal('x', getline(1))
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 bwipe!
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
84 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
85 endfunc
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
86
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
87 " 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
88 " in virtual edit mode.
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
89 func Test_paste_in_tab()
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
90 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
91 call append(0, '')
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
92 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
93
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
94 " 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
95 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
96
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
97 " 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
98 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
99 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
100 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
101 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
102
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
103 " 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
104 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
105 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
106 normal P
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
107 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
108
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
109 " 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
110 call setline(1, "a\tb")
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
111 call cursor(1, 2, 6)
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
112 normal p
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
113 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
114
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
115 " 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
116 call setline(1, "a\tb")
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
117 call cursor(1, 2, 6)
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
118 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
119 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
120
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
121 " 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
122 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
123
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
124 " 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
125 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
126 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
127 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
128 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
129
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
130 " 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
131 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
132 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
133 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
134 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
135
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
136 " 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
137 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
138 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
139 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
140 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
141
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
142 " 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
143 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
144 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
145 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
146 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
147
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
148 " 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
149
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
150 " 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
151 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
152 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
153 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
154 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
155 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
156
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
157 " 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
158 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
159 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
160 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
161 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
162 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
163
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
164 " 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
165 call setline(1, "a\tb")
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
166 call cursor(1, 2, 6)
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
167 normal gp
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
168 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
169 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
170
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
171 " 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
172 call setline(1, "a\tb")
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
173 call cursor(1, 2, 6)
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
174 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
175 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
176 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
177
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
178 " 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
179 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
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) 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
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, 2)
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 "rgp
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, 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
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) 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
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, 2)
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 "rgP
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('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
193 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
194
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
195 bwipe!
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
196 set virtualedit=
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18481
diff changeset
197 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
198
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
199 " 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
200 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
201 new
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
202 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
203 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
204 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
205 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
206 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
207 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
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 bwipe!
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
210 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
211 endfunc
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
212
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
213 " vim: shiftwidth=2 sts=2 expandtab