annotate src/testdir/test_registers.vim @ 30978:1b194361b71a v9.0.0824

patch 9.0.0824: crash when using win_move_separator() in other tab page Commit: https://github.com/vim/vim/commit/873f41a0187e81a22aa4622fbf938de72a54abba Author: zeertzjq <zeertzjq@outlook.com> Date: Tue Nov 1 11:44:43 2022 +0000 patch 9.0.0824: crash when using win_move_separator() in other tab page Problem: Crash when using win_move_separator() in other tab page. Solution: Check for valid window in current tab page. (closes #11479, closes #11427)
author Bram Moolenaar <Bram@vim.org>
date Wed, 02 Nov 2022 11:18:54 +0100
parents 1c688281673d
children 83b25278bac3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
1 " Tests for register operations
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
2
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
3 source check.vim
21246
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
4 source view_util.vim
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
5
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
6 " This test must be executed first to check for empty and unset registers.
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
7 func Test_aaa_empty_reg_test()
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
8 call assert_fails('normal @@', 'E748:')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
9 call assert_fails('normal @%', 'E354:')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
10 call assert_fails('normal @#', 'E354:')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
11 call assert_fails('normal @!', 'E354:')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
12 call assert_fails('normal @:', 'E30:')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
13 call assert_fails('normal @.', 'E29:')
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
14 call assert_fails('put /', 'E35:')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
15 call assert_fails('put .', 'E29:')
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
16 endfunc
11682
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 func Test_yank_shows_register()
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 enew
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 set report=0
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 call setline(1, ['foo', 'bar'])
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 " Line-wise
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 exe 'norm! yy'
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 call assert_equal('1 line yanked', v:statusmsg)
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 exe 'norm! "zyy'
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 call assert_equal('1 line yanked into "z', v:statusmsg)
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 exe 'norm! yj'
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 call assert_equal('2 lines yanked', v:statusmsg)
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 exe 'norm! "zyj'
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 call assert_equal('2 lines yanked into "z', v:statusmsg)
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 " Block-wise
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 exe "norm! \<C-V>y"
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 call assert_equal('block of 1 line yanked', v:statusmsg)
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 exe "norm! \<C-V>\"zy"
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 call assert_equal('block of 1 line yanked into "z', v:statusmsg)
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 exe "norm! \<C-V>jy"
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 call assert_equal('block of 2 lines yanked', v:statusmsg)
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 exe "norm! \<C-V>j\"zy"
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 call assert_equal('block of 2 lines yanked into "z', v:statusmsg)
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 bwipe!
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 endfunc
13855
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
44
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
45 func Test_display_registers()
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
46 e file1
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
47 e file2
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
48 call setline(1, ['foo', 'bar'])
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
49 /bar
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
50 exe 'norm! y2l"axx'
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
51 call feedkeys("i\<C-R>=2*4\n\<esc>")
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
52 call feedkeys(":ls\n", 'xt')
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
53
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
54 let a = execute('display')
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
55 let b = execute('registers')
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
56
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
57 call assert_equal(a, b)
18436
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
58 call assert_match('^\nType Name Content\n'
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
59 \ . ' c "" a\n'
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
60 \ . ' c "0 ba\n'
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
61 \ . ' c "a b\n'
13855
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
62 \ . '.*'
18436
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
63 \ . ' c "- a\n'
13855
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
64 \ . '.*'
18436
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
65 \ . ' c ": ls\n'
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
66 \ . ' c "% file2\n'
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
67 \ . ' c "# file1\n'
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
68 \ . ' c "/ bar\n'
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
69 \ . ' c "= 2\*4', a)
13855
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
70
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
71 let a = execute('registers a')
18436
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
72 call assert_match('^\nType Name Content\n'
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
73 \ . ' c "a b', a)
13855
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
74
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
75 let a = execute('registers :')
18436
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
76 call assert_match('^\nType Name Content\n'
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
77 \ . ' c ": ls', a)
13855
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
78
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
79 bwipe!
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
80 endfunc
15987
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
81
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
82 func Test_register_one()
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
83 " delete a line goes into register one
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
84 new
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
85 call setline(1, "one")
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
86 normal dd
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
87 call assert_equal("one\n", @1)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
88
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
89 " delete a word does not change register one, does change "-
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
90 call setline(1, "two")
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
91 normal de
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
92 call assert_equal("one\n", @1)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
93 call assert_equal("two", @-)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
94
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
95 " delete a word with a register does not change register one
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
96 call setline(1, "three")
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
97 normal "ade
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
98 call assert_equal("three", @a)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
99 call assert_equal("one\n", @1)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
100
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
101 " delete a word with register DOES change register one with one of a list of
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
102 " operators
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
103 " %
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
104 call setline(1, ["(12)3"])
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
105 normal "ad%
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
106 call assert_equal("(12)", @a)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
107 call assert_equal("(12)", @1)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
108
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
109 " (
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
110 call setline(1, ["first second"])
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
111 normal $"ad(
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
112 call assert_equal("first secon", @a)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
113 call assert_equal("first secon", @1)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
114
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
115 " )
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
116 call setline(1, ["First Second."])
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
117 normal gg0"ad)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
118 call assert_equal("First Second.", @a)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
119 call assert_equal("First Second.", @1)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
120
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
121 " `
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
122 call setline(1, ["start here."])
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
123 normal gg0fhmx0"ad`x
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
124 call assert_equal("start ", @a)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
125 call assert_equal("start ", @1)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
126
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
127 " /
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
128 call setline(1, ["searchX"])
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
129 exe "normal gg0\"ad/X\<CR>"
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
130 call assert_equal("search", @a)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
131 call assert_equal("search", @1)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
132
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
133 " ?
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
134 call setline(1, ["Ysearch"])
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
135 exe "normal gg$\"ad?Y\<CR>"
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
136 call assert_equal("Ysearc", @a)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
137 call assert_equal("Ysearc", @1)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
138
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
139 " n
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
140 call setline(1, ["Ynext"])
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
141 normal gg$"adn
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
142 call assert_equal("Ynex", @a)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
143 call assert_equal("Ynex", @1)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
144
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
145 " N
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
146 call setline(1, ["prevY"])
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
147 normal gg0"adN
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
148 call assert_equal("prev", @a)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
149 call assert_equal("prev", @1)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
150
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
151 " }
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
152 call setline(1, ["one", ""])
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
153 normal gg0"ad}
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
154 call assert_equal("one\n", @a)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
155 call assert_equal("one\n", @1)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
156
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
157 " {
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
158 call setline(1, ["", "two"])
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
159 normal 2G$"ad{
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
160 call assert_equal("\ntw", @a)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
161 call assert_equal("\ntw", @1)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
162
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
163 bwipe!
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
164 endfunc
15995
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
165
21246
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
166 func Test_recording_status_in_ex_line()
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
167 norm qx
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
168 redraw!
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
169 call assert_equal('recording @x', Screenline(&lines))
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
170 set shortmess=q
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
171 redraw!
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
172 call assert_equal('recording', Screenline(&lines))
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
173 set shortmess&
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
174 norm q
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
175 redraw!
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
176 call assert_equal('', Screenline(&lines))
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
177 endfunc
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
178
15995
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
179 " Check that replaying a typed sequence does not use an Esc and following
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
180 " characters as an escape sequence.
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
181 func Test_recording_esc_sequence()
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
182 new
15999
f4c282082ec8 patch 8.1.1005: test fails because t_F2 is not set
Bram Moolenaar <Bram@vim.org>
parents: 15995
diff changeset
183 try
f4c282082ec8 patch 8.1.1005: test fails because t_F2 is not set
Bram Moolenaar <Bram@vim.org>
parents: 15995
diff changeset
184 let save_F2 = &t_F2
f4c282082ec8 patch 8.1.1005: test fails because t_F2 is not set
Bram Moolenaar <Bram@vim.org>
parents: 15995
diff changeset
185 catch
f4c282082ec8 patch 8.1.1005: test fails because t_F2 is not set
Bram Moolenaar <Bram@vim.org>
parents: 15995
diff changeset
186 endtry
15995
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
187 let t_F2 = "\<Esc>OQ"
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
188 call feedkeys("qqiTest\<Esc>", "xt")
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
189 call feedkeys("OQuirk\<Esc>q", "xt")
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
190 call feedkeys("Go\<Esc>@q", "xt")
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
191 call assert_equal(['Quirk', 'Test', 'Quirk', 'Test'], getline(1, 4))
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
192 bwipe!
15999
f4c282082ec8 patch 8.1.1005: test fails because t_F2 is not set
Bram Moolenaar <Bram@vim.org>
parents: 15995
diff changeset
193 if exists('save_F2')
16784
62d84ef82f96 patch 8.1.1394: not restoring t_F2 in registers test
Bram Moolenaar <Bram@vim.org>
parents: 16376
diff changeset
194 let &t_F2 = save_F2
16376
3b5d401a58ce patch 8.1.1193: typos and small problems in test files
Bram Moolenaar <Bram@vim.org>
parents: 15999
diff changeset
195 else
3b5d401a58ce patch 8.1.1193: typos and small problems in test files
Bram Moolenaar <Bram@vim.org>
parents: 15999
diff changeset
196 set t_F2=
15999
f4c282082ec8 patch 8.1.1005: test fails because t_F2 is not set
Bram Moolenaar <Bram@vim.org>
parents: 15995
diff changeset
197 endif
15995
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
198 endfunc
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
199
26929
9975bd408d6c patch 8.2.3993: when recording a change in Select mode char appears twice
Bram Moolenaar <Bram@vim.org>
parents: 25808
diff changeset
200 func Test_recording_with_select_mode()
9975bd408d6c patch 8.2.3993: when recording a change in Select mode char appears twice
Bram Moolenaar <Bram@vim.org>
parents: 25808
diff changeset
201 new
9975bd408d6c patch 8.2.3993: when recording a change in Select mode char appears twice
Bram Moolenaar <Bram@vim.org>
parents: 25808
diff changeset
202 call feedkeys("qacc12345\<Esc>gH98765\<Esc>q", "tx")
9975bd408d6c patch 8.2.3993: when recording a change in Select mode char appears twice
Bram Moolenaar <Bram@vim.org>
parents: 25808
diff changeset
203 call assert_equal("98765", getline(1))
9975bd408d6c patch 8.2.3993: when recording a change in Select mode char appears twice
Bram Moolenaar <Bram@vim.org>
parents: 25808
diff changeset
204 call assert_equal("cc12345\<Esc>gH98765\<Esc>", @a)
9975bd408d6c patch 8.2.3993: when recording a change in Select mode char appears twice
Bram Moolenaar <Bram@vim.org>
parents: 25808
diff changeset
205 call setline(1, 'asdf')
9975bd408d6c patch 8.2.3993: when recording a change in Select mode char appears twice
Bram Moolenaar <Bram@vim.org>
parents: 25808
diff changeset
206 normal! @a
9975bd408d6c patch 8.2.3993: when recording a change in Select mode char appears twice
Bram Moolenaar <Bram@vim.org>
parents: 25808
diff changeset
207 call assert_equal("98765", getline(1))
9975bd408d6c patch 8.2.3993: when recording a change in Select mode char appears twice
Bram Moolenaar <Bram@vim.org>
parents: 25808
diff changeset
208 bwipe!
9975bd408d6c patch 8.2.3993: when recording a change in Select mode char appears twice
Bram Moolenaar <Bram@vim.org>
parents: 25808
diff changeset
209 endfunc
9975bd408d6c patch 8.2.3993: when recording a change in Select mode char appears twice
Bram Moolenaar <Bram@vim.org>
parents: 25808
diff changeset
210
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
211 " Test for executing the last used register (@)
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
212 func Test_last_used_exec_reg()
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
213 " Test for the @: command
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
214 let a = ''
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
215 call feedkeys(":let a ..= 'Vim'\<CR>", 'xt')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
216 normal @:
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
217 call assert_equal('VimVim', a)
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
218
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
219 " Test for the @= command
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
220 let x = ''
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
221 let a = ":let x ..= 'Vim'\<CR>"
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
222 exe "normal @=a\<CR>"
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
223 normal @@
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
224 call assert_equal('VimVim', x)
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
225
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
226 " Test for the @. command
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
227 let a = ''
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
228 call feedkeys("i:let a ..= 'Edit'\<CR>", 'xt')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
229 normal @.
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
230 normal @@
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
231 call assert_equal('EditEdit', a)
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
232
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
233 " Test for repeating the last command-line in visual mode
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
234 call append(0, 'register')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
235 normal gg
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
236 let @r = ''
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
237 call feedkeys("v:yank R\<CR>", 'xt')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
238 call feedkeys("v@:", 'xt')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
239 call assert_equal("\nregister\nregister\n", @r)
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
240
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
241 enew!
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
242 endfunc
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
243
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
244 func Test_get_register()
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
245 enew
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
246 edit Xfile1
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
247 edit Xfile2
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
248 call assert_equal('Xfile2', getreg('%'))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
249 call assert_equal('Xfile1', getreg('#'))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
250
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
251 call feedkeys("iTwo\<Esc>", 'xt')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
252 call assert_equal('Two', getreg('.'))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
253 call assert_equal('', getreg('_'))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
254 call assert_beeps('normal ":yy')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
255 call assert_beeps('normal "%yy')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
256 call assert_beeps('normal ".yy')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
257
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
258 call assert_equal('', getreg("\<C-F>"))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
259 call assert_equal('', getreg("\<C-W>"))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
260 call assert_equal('', getreg("\<C-L>"))
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
261 " Change the last used register to '"' for the next test
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
262 normal! ""yy
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
263 let @" = 'happy'
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
264 call assert_equal('happy', getreg())
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
265 call assert_equal('happy', getreg(''))
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
266
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
267 call assert_equal('', getregtype('!'))
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
268 call assert_fails('echo getregtype([])', 'E730:')
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
269 call assert_equal('v', getregtype())
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
270 call assert_equal('v', getregtype(''))
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
271
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
272 " Test for inserting an invalid register content
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
273 call assert_beeps('exe "normal i\<C-R>!"')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
274
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
275 " Test for inserting a register with multiple lines
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
276 call deletebufline('', 1, '$')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
277 call setreg('r', ['a', 'b'])
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
278 exe "normal i\<C-R>r"
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
279 call assert_equal(['a', 'b', ''], getline(1, '$'))
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
280
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
281 " Test for inserting a multi-line register in the command line
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
282 call feedkeys(":\<C-R>r\<Esc>", 'xt')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
283 call assert_equal("a\rb\r", histget(':', -1))
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
284
20178
2fb397573541 patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
285 call assert_fails('let r = getreg("=", [])', 'E745:')
2fb397573541 patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
286 call assert_fails('let r = getreg("=", 1, [])', 'E745:')
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
287 enew!
22502
1503ecd54f8a patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
288
1503ecd54f8a patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
289 " Using a register in operator-pending mode should fail
1503ecd54f8a patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
290 call assert_beeps('norm! c"')
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
291 endfunc
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
292
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
293 func Test_set_register()
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
294 call assert_fails("call setreg('#', 200)", 'E86:')
24695
13efbfc53054 patch 8.2.2886: various pieces of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
295 call assert_fails("call setreg('a', test_unknown())", 'E908:')
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
296
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
297 edit Xfile_alt_1
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
298 let b1 = bufnr('')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
299 edit Xfile_alt_2
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
300 let b2 = bufnr('')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
301 edit Xfile_alt_3
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
302 let b3 = bufnr('')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
303 call setreg('#', 'alt_1')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
304 call assert_equal('Xfile_alt_1', getreg('#'))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
305 call setreg('#', b2)
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
306 call assert_equal('Xfile_alt_2', getreg('#'))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
307
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
308 let ab = 'regwrite'
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
309 call setreg('=', '')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
310 call setreg('=', 'a', 'a')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
311 call setreg('=', 'b', 'a')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
312 call assert_equal('regwrite', getreg('='))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
313
19195
2ef19eed524a patch 8.2.0156: various typos in source files and tests
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
314 " Test for setting a list of lines to special registers
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
315 call setreg('/', [])
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
316 call assert_equal('', @/)
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
317 call setreg('=', [])
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
318 call assert_equal('', @=)
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
319 call assert_fails("call setreg('/', ['a', 'b'])", 'E883:')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
320 call assert_fails("call setreg('=', ['a', 'b'])", 'E883:')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
321 call assert_equal(0, setreg('_', ['a', 'b']))
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
322
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
323 " Test for recording to a invalid register
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
324 call assert_beeps('normal q$')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
325
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
326 " Appending to a register when recording
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
327 call append(0, "text for clipboard test")
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
328 normal gg
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
329 call feedkeys('qrllq', 'xt')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
330 call feedkeys('qRhhq', 'xt')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
331 call assert_equal('llhh', getreg('r'))
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
332
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
333 " Appending a list of characters to a register from different lines
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
334 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
335 call append(0, ['abcdef', '123456'])
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
336 normal gg"ry3l
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
337 call cursor(2, 4)
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
338 normal "Ry3l
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
339 call assert_equal('abc456', @r)
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
340
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
341 " Test for gP with multiple lines selected using characterwise motion
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
342 %delete
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
343 call append(0, ['vim editor', 'vim editor'])
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
344 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
345 exe "normal ggwy/vim /e\<CR>gP"
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
346 call assert_equal(['vim editor', 'vim editor', 'vim editor'], getline(1, 3))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
347
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
348 " Test for gP with . register
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
349 %delete
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
350 normal iabc
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
351 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
352 call assert_equal('abcabc', 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
353 normal 0".gP
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
354 call assert_equal('abcabcabc', 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
355
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
356 let @"=''
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
357 call setreg('', '1')
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
358 call assert_equal('1', @")
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
359 call setreg('@', '2')
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
360 call assert_equal('2', @")
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
361
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
362 enew!
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
363 endfunc
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
364
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
365 " Test for clipboard registers (* and +)
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
366 func Test_clipboard_regs()
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
367 CheckNotGui
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
368 CheckFeature clipboard_working
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
369
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
370 new
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
371 call append(0, "text for clipboard test")
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
372 normal gg"*yiw
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
373 call assert_equal('text', getreg('*'))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
374 normal gg2w"+yiw
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
375 call assert_equal('clipboard', getreg('+'))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
376
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
377 " Test for replacing the clipboard register contents
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
378 set clipboard=unnamed
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
379 let @* = 'food'
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
380 normal ggviw"*p
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
381 call assert_equal('text', getreg('*'))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
382 call assert_equal('food for clipboard test', 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
383 normal ggviw"*p
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
384 call assert_equal('food', getreg('*'))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
385 call assert_equal('text for clipboard test', 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
386
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
387 " Test for replacing the selection register contents
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
388 set clipboard=unnamedplus
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
389 let @+ = 'food'
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
390 normal ggviw"+p
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
391 call assert_equal('text', getreg('+'))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
392 call assert_equal('food for clipboard test', 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
393 normal ggviw"+p
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
394 call assert_equal('food', getreg('+'))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
395 call assert_equal('text for clipboard test', 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
396
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
397 " Test for auto copying visually selected text to clipboard register
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
398 call setline(1, "text for clipboard test")
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
399 let @* = ''
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
400 set clipboard=autoselect
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
401 normal ggwwviwy
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
402 call assert_equal('clipboard', @*)
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
403
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
404 " Test for auto copying visually selected text to selection register
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
405 let @+ = ''
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
406 set clipboard=autoselectplus
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
407 normal ggwviwy
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
408 call assert_equal('for', @+)
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
409
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
410 set clipboard&vim
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
411 bwipe!
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
412 endfunc
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
413
29473
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
414 " Test unnamed for both clipboard registers (* and +)
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
415 func Test_clipboard_regs_both_unnamed()
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
416 CheckNotGui
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
417 CheckFeature clipboard_working
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
418 CheckTwoClipboards
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
419
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
420 let @* = 'xxx'
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
421 let @+ = 'xxx'
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
422
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
423 new
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
424
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
425 set clipboard=unnamed,unnamedplus
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
426 call setline(1, ['foo', 'bar'])
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
427
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
428 " op_yank copies to both
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
429 :1
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
430 :normal yw
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
431 call assert_equal('foo', getreg('*'))
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
432 call assert_equal('foo', getreg('+'))
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
433
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
434 " op_delete only copies to '+'
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
435 :2
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
436 :normal dw
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
437 call assert_equal('foo', getreg('*'))
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
438 call assert_equal('bar', getreg('+'))
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
439
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
440 set clipboard&vim
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
441 bwipe!
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
442 endfunc
1c688281673d patch 9.0.0078: star register is unexpectedly changed when deleting
Bram Moolenaar <Bram@vim.org>
parents: 28395
diff changeset
443
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
444 " Test for restarting the current mode (insert or virtual replace) after
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
445 " executing the contents of 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
446 func Test_put_reg_restart_mode()
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
447 new
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
448 call append(0, 'editor')
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
449 normal gg
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
450 let @r = "ivim \<Esc>"
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
451 call feedkeys("i\<C-O>@r\<C-R>=mode()\<CR>", 'xt')
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
452 call assert_equal('vimi editor', 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
453
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
454 call setline(1, 'editor')
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
455 normal gg
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
456 call feedkeys("gR\<C-O>@r\<C-R>=mode()\<CR>", 'xt')
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
457 call assert_equal('vimReditor', 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
458
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
459 bwipe!
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
460 endfunc
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
461
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
462 " Test for executing a register using :@ command
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
463 func Test_execute_register()
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
464 call setreg('r', [])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
465 call assert_beeps('@r')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
466 let i = 1
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
467 let @q = 'let i+= 1'
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
468 @q
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
469 @
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
470 call assert_equal(3, i)
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
471
22476
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
472 " try to execute expression register and use a backspace to cancel it
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
473 new
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
474 call feedkeys("@=\<BS>ax\<CR>y", 'xt')
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
475 call assert_equal(['x', 'y'], getline(1, '$'))
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
476 close!
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
477
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
478 " cannot execute a register in operator pending mode
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
479 call assert_beeps('normal! c@r')
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
480 endfunc
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
481
20743
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
482 " Test for getting register info
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
483 func Test_get_reginfo()
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
484 enew
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
485 call setline(1, ['foo', 'bar'])
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
486
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
487 exe 'norm! "zyy'
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
488 let info = getreginfo('"')
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
489 call assert_equal('z', info.points_to)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
490 call setreg('y', 'baz')
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
491 call assert_equal('z', getreginfo('').points_to)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
492 call setreg('y', { 'isunnamed': v:true })
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
493 call assert_equal('y', getreginfo('"').points_to)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
494
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
495 exe '$put'
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
496 call assert_equal(getreg('y'), getline(3))
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
497 call setreg('', 'qux')
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
498 call assert_equal('0', getreginfo('').points_to)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
499 call setreg('x', 'quux')
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
500 call assert_equal('0', getreginfo('').points_to)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
501
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
502 let info = getreginfo('')
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
503 call assert_equal(getreg('', 1, 1), info.regcontents)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
504 call assert_equal(getregtype(''), info.regtype)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
505
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
506 exe "norm! 0\<c-v>e" .. '"zy'
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
507 let info = getreginfo('z')
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
508 call assert_equal(getreg('z', 1, 1), info.regcontents)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
509 call assert_equal(getregtype('z'), info.regtype)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
510 call assert_equal(1, +info.isunnamed)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
511
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
512 let info = getreginfo('"')
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
513 call assert_equal('z', info.points_to)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
514
24695
13efbfc53054 patch 8.2.2886: various pieces of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
515 let @a="a1b2"
13efbfc53054 patch 8.2.2886: various pieces of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
516 nnoremap <F2> <Cmd>let g:RegInfo = getreginfo()<CR>
13efbfc53054 patch 8.2.2886: various pieces of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
517 exe "normal \"a\<F2>"
13efbfc53054 patch 8.2.2886: various pieces of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
518 call assert_equal({'regcontents': ['a1b2'], 'isunnamed': v:false,
13efbfc53054 patch 8.2.2886: various pieces of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
519 \ 'regtype': 'v'}, g:RegInfo)
13efbfc53054 patch 8.2.2886: various pieces of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
520 nunmap <F2>
13efbfc53054 patch 8.2.2886: various pieces of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
521 unlet g:RegInfo
13efbfc53054 patch 8.2.2886: various pieces of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
522
20743
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
523 bwipe!
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
524 endfunc
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
525
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
526 " Test for restoring register with dict from getreginfo
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
527 func Test_set_register_dict()
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
528 enew!
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
529
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
530 call setreg('"', #{ regcontents: ['one', 'two'],
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
531 \ regtype: 'V', points_to: 'z' })
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
532 call assert_equal(['one', 'two'], getreg('"', 1, 1))
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
533 let info = getreginfo('"')
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
534 call assert_equal('z', info.points_to)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
535 call assert_equal('V', info.regtype)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
536 call assert_equal(1, +getreginfo('z').isunnamed)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
537
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
538 call setreg('x', #{ regcontents: ['three', 'four'],
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
539 \ regtype: 'v', isunnamed: v:true })
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
540 call assert_equal(['three', 'four'], getreg('"', 1, 1))
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
541 let info = getreginfo('"')
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
542 call assert_equal('x', info.points_to)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
543 call assert_equal('v', info.regtype)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
544 call assert_equal(1, +getreginfo('x').isunnamed)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
545
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
546 call setreg('y', #{ regcontents: 'five',
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
547 \ regtype: "\<c-v>", isunnamed: v:false })
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
548 call assert_equal("\<c-v>4", getreginfo('y').regtype)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
549 call assert_equal(0, +getreginfo('y').isunnamed)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
550 call assert_equal(['three', 'four'], getreg('"', 1, 1))
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
551 call assert_equal('x', getreginfo('"').points_to)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
552
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
553 call setreg('"', #{ regcontents: 'six' })
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
554 call assert_equal('0', getreginfo('"').points_to)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
555 call assert_equal(1, +getreginfo('0').isunnamed)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
556 call assert_equal(['six'], getreginfo('0').regcontents)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
557 call assert_equal(['six'], getreginfo('"').regcontents)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
558
20968
1c36b96522ae patch 8.2.1035: setreg() does not always clear the register
Bram Moolenaar <Bram@vim.org>
parents: 20891
diff changeset
559 let @x = 'one'
1c36b96522ae patch 8.2.1035: setreg() does not always clear the register
Bram Moolenaar <Bram@vim.org>
parents: 20891
diff changeset
560 call setreg('x', {})
1c36b96522ae patch 8.2.1035: setreg() does not always clear the register
Bram Moolenaar <Bram@vim.org>
parents: 20891
diff changeset
561 call assert_equal(1, len(split(execute('reg x'), '\n')))
1c36b96522ae patch 8.2.1035: setreg() does not always clear the register
Bram Moolenaar <Bram@vim.org>
parents: 20891
diff changeset
562
1c36b96522ae patch 8.2.1035: setreg() does not always clear the register
Bram Moolenaar <Bram@vim.org>
parents: 20891
diff changeset
563 call assert_fails("call setreg('0', #{regtype: 'V'}, 'v')", 'E118:')
1c36b96522ae patch 8.2.1035: setreg() does not always clear the register
Bram Moolenaar <Bram@vim.org>
parents: 20891
diff changeset
564 call assert_fails("call setreg('0', #{regtype: 'X'})", 'E475:')
1c36b96522ae patch 8.2.1035: setreg() does not always clear the register
Bram Moolenaar <Bram@vim.org>
parents: 20891
diff changeset
565 call assert_fails("call setreg('0', #{regtype: 'vy'})", 'E475:')
1c36b96522ae patch 8.2.1035: setreg() does not always clear the register
Bram Moolenaar <Bram@vim.org>
parents: 20891
diff changeset
566
20743
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
567 bwipe!
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
568 endfunc
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
569
20754
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
570 func Test_v_register()
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
571 enew
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
572 call setline(1, 'nothing')
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
573
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
574 func s:Put()
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
575 let s:register = v:register
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
576 exec 'normal! "' .. v:register .. 'P'
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
577 endfunc
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
578 nnoremap <buffer> <plug>(test) :<c-u>call s:Put()<cr>
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
579 nmap <buffer> S <plug>(test)
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
580
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
581 let @z = "testz\n"
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
582 let @" = "test@\n"
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
583
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
584 let s:register = ''
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
585 call feedkeys('"_ddS', 'mx')
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
586 call assert_equal('test@', getline('.')) " fails before 8.2.0929
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
587 call assert_equal('"', s:register) " fails before 8.2.0929
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
588
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
589 let s:register = ''
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
590 call feedkeys('"zS', 'mx')
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
591 call assert_equal('z', s:register)
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
592
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
593 let s:register = ''
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
594 call feedkeys('"zSS', 'mx')
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
595 call assert_equal('"', s:register)
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
596
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
597 let s:register = ''
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
598 call feedkeys('"_S', 'mx')
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
599 call assert_equal('_', s:register)
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
600
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
601 let s:register = ''
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
602 normal "_ddS
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
603 call assert_equal('"', s:register) " fails before 8.2.0929
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
604 call assert_equal('test@', getline('.')) " fails before 8.2.0929
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
605
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
606 let s:register = ''
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
607 execute 'normal "z:call' "s:Put()\n"
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
608 call assert_equal('z', s:register)
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
609 call assert_equal('testz', getline('.'))
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
610
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
611 " Test operator and omap
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
612 let @b = 'testb'
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
613 func s:OpFunc(...)
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
614 let s:register2 = v:register
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
615 endfunc
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
616 set opfunc=s:OpFunc
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
617
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
618 normal "bg@l
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
619 normal S
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
620 call assert_equal('"', s:register) " fails before 8.2.0929
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
621 call assert_equal('b', s:register2)
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
622
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
623 func s:Motion()
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
624 let s:register1 = v:register
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
625 normal! l
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
626 endfunc
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
627 onoremap <buffer> Q :<c-u>call s:Motion()<cr>
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
628
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
629 normal "bg@Q
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
630 normal S
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
631 call assert_equal('"', s:register)
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
632 call assert_equal('b', s:register1)
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
633 call assert_equal('"', s:register2)
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
634
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
635 set opfunc&
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
636 bwipe!
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
637 endfunc
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
638
20891
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
639 " Test for executing the contents of a register as an Ex command with line
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
640 " continuation.
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
641 func Test_execute_reg_as_ex_cmd()
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
642 " Line continuation with just two lines
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
643 let code =<< trim END
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
644 let l = [
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
645 \ 1]
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
646 END
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
647 let @r = code->join("\n")
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
648 let l = []
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
649 @r
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
650 call assert_equal([1], l)
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
651
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
652 " Line continuation with more than two lines
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
653 let code =<< trim END
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
654 let l = [
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
655 \ 1,
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
656 \ 2,
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
657 \ 3]
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
658 END
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
659 let @r = code->join("\n")
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
660 let l = []
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
661 @r
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
662 call assert_equal([1, 2, 3], l)
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
663
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
664 " use comments interspersed with code
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
665 let code =<< trim END
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
666 let l = [
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
667 "\ one
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
668 \ 1,
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
669 "\ two
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
670 \ 2,
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
671 "\ three
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
672 \ 3]
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
673 END
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
674 let @r = code->join("\n")
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
675 let l = []
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
676 @r
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
677 call assert_equal([1, 2, 3], l)
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
678
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
679 " use line continuation in the middle
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
680 let code =<< trim END
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
681 let a = "one"
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
682 let l = [
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
683 \ 1,
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
684 \ 2]
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
685 let b = "two"
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
686 END
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
687 let @r = code->join("\n")
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
688 let l = []
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
689 @r
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
690 call assert_equal([1, 2], l)
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
691 call assert_equal("one", a)
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
692 call assert_equal("two", b)
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
693
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
694 " only one line with a \
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
695 let @r = "\\let l = 1"
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
696 call assert_fails('@r', 'E10:')
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
697
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
698 " only one line with a "\
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
699 let @r = ' "\ let i = 1'
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
700 @r
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
701 call assert_false(exists('i'))
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
702
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
703 " first line also begins with a \
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
704 let @r = "\\let l = [\n\\ 1]"
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
705 call assert_fails('@r', 'E10:')
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
706
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
707 " Test with a large number of lines
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
708 let @r = "let str = \n"
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
709 let @r ..= repeat(" \\ 'abcdefghijklmnopqrstuvwxyz' ..\n", 312)
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
710 let @r ..= ' \ ""'
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
711 @r
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
712 call assert_equal(repeat('abcdefghijklmnopqrstuvwxyz', 312), str)
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
713 endfunc
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
714
20976
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
715 " Test for clipboard registers with ASCII NUL
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
716 func Test_clipboard_nul()
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
717 CheckFeature clipboard_working
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
718 new
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
719
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
720 " Test for putting ASCII NUL into the clipboard
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
721 set clipboard=unnamed
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
722 call append(0, "\ntest")
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
723 normal ggyyp
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
724 call assert_equal("^@test^@", strtrans(getreg('*')))
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
725 call assert_equal(getline(1), getline(2))
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
726 let b = split(execute(":reg *"), "\n")
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
727 call assert_match('"\*\s*\^@test\^J',b[1])
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
728
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
729 set clipboard&vim
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
730 bwipe!
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
731 endfunc
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
732
21238
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
733 func Test_ve_blockpaste()
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
734 new
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
735 set ve=all
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
736 0put =['QWERTZ','ASDFGH']
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
737 call cursor(1,1)
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
738 exe ":norm! \<C-V>3ljdP"
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
739 call assert_equal(1, col('.'))
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
740 call assert_equal(getline(1, 2), ['QWERTZ', 'ASDFGH'])
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
741 call cursor(1,1)
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
742 exe ":norm! \<C-V>3ljd"
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
743 call cursor(1,1)
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
744 norm! $3lP
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
745 call assert_equal(5, col('.'))
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
746 call assert_equal(getline(1, 2), ['TZ QWER', 'GH ASDF'])
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
747 set ve&vim
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
748 bwipe!
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
749 endfunc
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
750
23287
f2a70fca3485 patch 8.2.2189: cannot repeat a command that uses the small delete register
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
751 func Test_insert_small_delete()
f2a70fca3485 patch 8.2.2189: cannot repeat a command that uses the small delete register
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
752 new
f2a70fca3485 patch 8.2.2189: cannot repeat a command that uses the small delete register
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
753 call setline(1, ['foo foobar bar'])
f2a70fca3485 patch 8.2.2189: cannot repeat a command that uses the small delete register
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
754 call cursor(1,1)
f2a70fca3485 patch 8.2.2189: cannot repeat a command that uses the small delete register
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
755 exe ":norm! ciw'\<C-R>-'"
23303
9af15022894c patch 8.2.2197: assert arguments order reversed
Bram Moolenaar <Bram@vim.org>
parents: 23287
diff changeset
756 call assert_equal("'foo' foobar bar", getline(1))
23287
f2a70fca3485 patch 8.2.2189: cannot repeat a command that uses the small delete register
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
757 exe ":norm! w.w."
23303
9af15022894c patch 8.2.2197: assert arguments order reversed
Bram Moolenaar <Bram@vim.org>
parents: 23287
diff changeset
758 call assert_equal("'foo' 'foobar' 'bar'", getline(1))
23287
f2a70fca3485 patch 8.2.2189: cannot repeat a command that uses the small delete register
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
759 bwipe!
f2a70fca3485 patch 8.2.2189: cannot repeat a command that uses the small delete register
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
760 endfunc
f2a70fca3485 patch 8.2.2189: cannot repeat a command that uses the small delete register
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
761
24134
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23303
diff changeset
762 " Record in insert mode using CTRL-O
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23303
diff changeset
763 func Test_record_in_insert_mode()
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23303
diff changeset
764 new
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23303
diff changeset
765 let @r = ''
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23303
diff changeset
766 call setline(1, ['foo'])
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23303
diff changeset
767 call feedkeys("i\<C-O>qrbaz\<C-O>q", 'xt')
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23303
diff changeset
768 call assert_equal('baz', @r)
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23303
diff changeset
769 bwipe!
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23303
diff changeset
770 endfunc
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23303
diff changeset
771
27410
5d6774c0df4f patch 8.2.4233: crash when recording and using Select mode
Bram Moolenaar <Bram@vim.org>
parents: 26929
diff changeset
772 func Test_record_in_select_mode()
5d6774c0df4f patch 8.2.4233: crash when recording and using Select mode
Bram Moolenaar <Bram@vim.org>
parents: 26929
diff changeset
773 new
5d6774c0df4f patch 8.2.4233: crash when recording and using Select mode
Bram Moolenaar <Bram@vim.org>
parents: 26929
diff changeset
774 call setline(1, 'text')
5d6774c0df4f patch 8.2.4233: crash when recording and using Select mode
Bram Moolenaar <Bram@vim.org>
parents: 26929
diff changeset
775 sil norm q00
5d6774c0df4f patch 8.2.4233: crash when recording and using Select mode
Bram Moolenaar <Bram@vim.org>
parents: 26929
diff changeset
776 sil norm q
5d6774c0df4f patch 8.2.4233: crash when recording and using Select mode
Bram Moolenaar <Bram@vim.org>
parents: 26929
diff changeset
777 call assert_equal('0ext', getline(1))
27418
6ecfb8d99353 patch 8.2.4237: record buffer wrong if character in Select mode was not typed
Bram Moolenaar <Bram@vim.org>
parents: 27410
diff changeset
778
6ecfb8d99353 patch 8.2.4237: record buffer wrong if character in Select mode was not typed
Bram Moolenaar <Bram@vim.org>
parents: 27410
diff changeset
779 %delete
6ecfb8d99353 patch 8.2.4237: record buffer wrong if character in Select mode was not typed
Bram Moolenaar <Bram@vim.org>
parents: 27410
diff changeset
780 let @r = ''
6ecfb8d99353 patch 8.2.4237: record buffer wrong if character in Select mode was not typed
Bram Moolenaar <Bram@vim.org>
parents: 27410
diff changeset
781 call setline(1, ['abc', 'abc', 'abc'])
6ecfb8d99353 patch 8.2.4237: record buffer wrong if character in Select mode was not typed
Bram Moolenaar <Bram@vim.org>
parents: 27410
diff changeset
782 smap <F2> <Right><Right>,
6ecfb8d99353 patch 8.2.4237: record buffer wrong if character in Select mode was not typed
Bram Moolenaar <Bram@vim.org>
parents: 27410
diff changeset
783 call feedkeys("qrgh\<F2>Dk\<Esc>q", 'xt')
6ecfb8d99353 patch 8.2.4237: record buffer wrong if character in Select mode was not typed
Bram Moolenaar <Bram@vim.org>
parents: 27410
diff changeset
784 call assert_equal("gh\<F2>Dk\<Esc>", @r)
6ecfb8d99353 patch 8.2.4237: record buffer wrong if character in Select mode was not typed
Bram Moolenaar <Bram@vim.org>
parents: 27410
diff changeset
785 norm j0@rj0@@
6ecfb8d99353 patch 8.2.4237: record buffer wrong if character in Select mode was not typed
Bram Moolenaar <Bram@vim.org>
parents: 27410
diff changeset
786 call assert_equal([',Dk', ',Dk', ',Dk'], getline(1, 3))
6ecfb8d99353 patch 8.2.4237: record buffer wrong if character in Select mode was not typed
Bram Moolenaar <Bram@vim.org>
parents: 27410
diff changeset
787 sunmap <F2>
6ecfb8d99353 patch 8.2.4237: record buffer wrong if character in Select mode was not typed
Bram Moolenaar <Bram@vim.org>
parents: 27410
diff changeset
788
27410
5d6774c0df4f patch 8.2.4233: crash when recording and using Select mode
Bram Moolenaar <Bram@vim.org>
parents: 26929
diff changeset
789 bwipe!
5d6774c0df4f patch 8.2.4233: crash when recording and using Select mode
Bram Moolenaar <Bram@vim.org>
parents: 26929
diff changeset
790 endfunc
5d6774c0df4f patch 8.2.4233: crash when recording and using Select mode
Bram Moolenaar <Bram@vim.org>
parents: 26929
diff changeset
791
28395
a0cd2b7a78ef patch 8.2.4722: ending recording with mapping records too much
Bram Moolenaar <Bram@vim.org>
parents: 28359
diff changeset
792 " mapping that ends macro recording should be removed from recorded macro
a0cd2b7a78ef patch 8.2.4722: ending recording with mapping records too much
Bram Moolenaar <Bram@vim.org>
parents: 28359
diff changeset
793 func Test_end_record_using_mapping()
a0cd2b7a78ef patch 8.2.4722: ending recording with mapping records too much
Bram Moolenaar <Bram@vim.org>
parents: 28359
diff changeset
794 call setline(1, 'aaa')
a0cd2b7a78ef patch 8.2.4722: ending recording with mapping records too much
Bram Moolenaar <Bram@vim.org>
parents: 28359
diff changeset
795 nnoremap s q
a0cd2b7a78ef patch 8.2.4722: ending recording with mapping records too much
Bram Moolenaar <Bram@vim.org>
parents: 28359
diff changeset
796 call feedkeys('safas', 'tx')
a0cd2b7a78ef patch 8.2.4722: ending recording with mapping records too much
Bram Moolenaar <Bram@vim.org>
parents: 28359
diff changeset
797 call assert_equal('fa', @a)
a0cd2b7a78ef patch 8.2.4722: ending recording with mapping records too much
Bram Moolenaar <Bram@vim.org>
parents: 28359
diff changeset
798 nunmap s
a0cd2b7a78ef patch 8.2.4722: ending recording with mapping records too much
Bram Moolenaar <Bram@vim.org>
parents: 28359
diff changeset
799
a0cd2b7a78ef patch 8.2.4722: ending recording with mapping records too much
Bram Moolenaar <Bram@vim.org>
parents: 28359
diff changeset
800 nnoremap xx q
a0cd2b7a78ef patch 8.2.4722: ending recording with mapping records too much
Bram Moolenaar <Bram@vim.org>
parents: 28359
diff changeset
801 call feedkeys('0xxafaxx', 'tx')
a0cd2b7a78ef patch 8.2.4722: ending recording with mapping records too much
Bram Moolenaar <Bram@vim.org>
parents: 28359
diff changeset
802 call assert_equal('fa', @a)
a0cd2b7a78ef patch 8.2.4722: ending recording with mapping records too much
Bram Moolenaar <Bram@vim.org>
parents: 28359
diff changeset
803 nunmap xx
a0cd2b7a78ef patch 8.2.4722: ending recording with mapping records too much
Bram Moolenaar <Bram@vim.org>
parents: 28359
diff changeset
804
a0cd2b7a78ef patch 8.2.4722: ending recording with mapping records too much
Bram Moolenaar <Bram@vim.org>
parents: 28359
diff changeset
805 nnoremap xsx q
a0cd2b7a78ef patch 8.2.4722: ending recording with mapping records too much
Bram Moolenaar <Bram@vim.org>
parents: 28359
diff changeset
806 call feedkeys('0qafaxsx', 'tx')
a0cd2b7a78ef patch 8.2.4722: ending recording with mapping records too much
Bram Moolenaar <Bram@vim.org>
parents: 28359
diff changeset
807 call assert_equal('fa', @a)
a0cd2b7a78ef patch 8.2.4722: ending recording with mapping records too much
Bram Moolenaar <Bram@vim.org>
parents: 28359
diff changeset
808 nunmap xsx
a0cd2b7a78ef patch 8.2.4722: ending recording with mapping records too much
Bram Moolenaar <Bram@vim.org>
parents: 28359
diff changeset
809
a0cd2b7a78ef patch 8.2.4722: ending recording with mapping records too much
Bram Moolenaar <Bram@vim.org>
parents: 28359
diff changeset
810 bwipe!
a0cd2b7a78ef patch 8.2.4722: ending recording with mapping records too much
Bram Moolenaar <Bram@vim.org>
parents: 28359
diff changeset
811 endfunc
a0cd2b7a78ef patch 8.2.4722: ending recording with mapping records too much
Bram Moolenaar <Bram@vim.org>
parents: 28359
diff changeset
812
28359
390dfc3e409b patch 8.2.4705: jump list marker disappears
Bram Moolenaar <Bram@vim.org>
parents: 27418
diff changeset
813 func Test_end_reg_executing()
390dfc3e409b patch 8.2.4705: jump list marker disappears
Bram Moolenaar <Bram@vim.org>
parents: 27418
diff changeset
814 nnoremap s <Nop>
390dfc3e409b patch 8.2.4705: jump list marker disappears
Bram Moolenaar <Bram@vim.org>
parents: 27418
diff changeset
815 let @a = 's'
390dfc3e409b patch 8.2.4705: jump list marker disappears
Bram Moolenaar <Bram@vim.org>
parents: 27418
diff changeset
816 call feedkeys("@aqaq\<Esc>", 'tx')
390dfc3e409b patch 8.2.4705: jump list marker disappears
Bram Moolenaar <Bram@vim.org>
parents: 27418
diff changeset
817 call assert_equal('', @a)
390dfc3e409b patch 8.2.4705: jump list marker disappears
Bram Moolenaar <Bram@vim.org>
parents: 27418
diff changeset
818 call assert_equal('', getline(1))
390dfc3e409b patch 8.2.4705: jump list marker disappears
Bram Moolenaar <Bram@vim.org>
parents: 27418
diff changeset
819
390dfc3e409b patch 8.2.4705: jump list marker disappears
Bram Moolenaar <Bram@vim.org>
parents: 27418
diff changeset
820 call setline(1, 'aaa')
390dfc3e409b patch 8.2.4705: jump list marker disappears
Bram Moolenaar <Bram@vim.org>
parents: 27418
diff changeset
821 nnoremap s qa
390dfc3e409b patch 8.2.4705: jump list marker disappears
Bram Moolenaar <Bram@vim.org>
parents: 27418
diff changeset
822 let @a = 'fa'
390dfc3e409b patch 8.2.4705: jump list marker disappears
Bram Moolenaar <Bram@vim.org>
parents: 27418
diff changeset
823 call feedkeys("@asq\<Esc>", 'tx')
390dfc3e409b patch 8.2.4705: jump list marker disappears
Bram Moolenaar <Bram@vim.org>
parents: 27418
diff changeset
824 call assert_equal('', @a)
390dfc3e409b patch 8.2.4705: jump list marker disappears
Bram Moolenaar <Bram@vim.org>
parents: 27418
diff changeset
825 call assert_equal('aaa', getline(1))
390dfc3e409b patch 8.2.4705: jump list marker disappears
Bram Moolenaar <Bram@vim.org>
parents: 27418
diff changeset
826
390dfc3e409b patch 8.2.4705: jump list marker disappears
Bram Moolenaar <Bram@vim.org>
parents: 27418
diff changeset
827 nunmap s
390dfc3e409b patch 8.2.4705: jump list marker disappears
Bram Moolenaar <Bram@vim.org>
parents: 27418
diff changeset
828 bwipe!
390dfc3e409b patch 8.2.4705: jump list marker disappears
Bram Moolenaar <Bram@vim.org>
parents: 27418
diff changeset
829 endfunc
390dfc3e409b patch 8.2.4705: jump list marker disappears
Bram Moolenaar <Bram@vim.org>
parents: 27418
diff changeset
830
25808
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
831 " Make sure that y_append is correctly reset
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
832 " and the previous register is working as expected
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
833 func Test_register_y_append_reset()
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
834 new
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
835 call setline(1, ['1',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
836 \ '2 ----------------------------------------------------',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
837 \ '3',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
838 \ '4',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
839 \ '5 ----------------------------------------------------',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
840 \ '6',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
841 \ '7',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
842 \ '8 ----------------------------------------------------',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
843 \ '9',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
844 \ '10 aaaaaaa 4.',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
845 \ '11 Game Dbl-Figures Leaders:',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
846 \ '12 Player Pts FG% 3P% FT% RB AS BL ST TO PF EFF',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
847 \ '13 bbbbbbbbb 12 (50 /0 /67 )/ 7/ 3/ 0/ 2/ 3/ 4/+15',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
848 \ '14 cccccc 12 (57 /67 /100)/ 2/ 1/ 1/ 0/ 1/ 3/+12',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
849 \ '15 ddddddd 10 (63 /0 /0 )/ 1/ 3/ 0/ 3/ 5/ 3/ +9',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
850 \ '16 4 5-15 0-3 2-2 5-12 1-1 3-4 33.3 0.0 100 41.7 100 75 12 14',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
851 \ '17 F 23-55 2-10 9-11 23-52 3-13 26-29 41.8 20 81.8 44.2 23.1 89.7 57 75',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
852 \ '18 4 3 6 3 2 3 3 4 3 3 7 3 1 4 6 -1 -1 +2 -1 -2',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
853 \ '19 F 13 19 5 10 4 17 22 9 14 32 13 4 20 17 -1 -13 -4 -3 -3 +5'])
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
854 11
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
855 exe "norm! \"a5dd"
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
856 norm! j
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
857 exe "norm! \"bY"
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
858 norm! 2j
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
859 exe "norm! \"BY"
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
860 norm! 4k
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
861 norm! 5dd
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
862 norm! 3k
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
863 " The next put should put the content of the unnamed register, not of
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
864 " register b!
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
865 norm! p
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
866 call assert_equal(['1',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
867 \ '2 ----------------------------------------------------',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
868 \ '3',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
869 \ '4',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
870 \ '5 ----------------------------------------------------',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
871 \ '6',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
872 \ '10 aaaaaaa 4.',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
873 \ '16 4 5-15 0-3 2-2 5-12 1-1 3-4 33.3 0.0 100 41.7 100 75 12 14',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
874 \ '17 F 23-55 2-10 9-11 23-52 3-13 26-29 41.8 20 81.8 44.2 23.1 89.7 57 75',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
875 \ '18 4 3 6 3 2 3 3 4 3 3 7 3 1 4 6 -1 -1 +2 -1 -2',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
876 \ '19 F 13 19 5 10 4 17 22 9 14 32 13 4 20 17 -1 -13 -4 -3 -3 +5',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
877 \ '7',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
878 \ '8 ----------------------------------------------------',
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
879 \ '9'], getline(1,'$'))
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
880 bwipe!
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
881 endfunc
b1440083f0da patch 8.2.3439: deleted lines go to wrong yank register
Bram Moolenaar <Bram@vim.org>
parents: 24695
diff changeset
882
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
883 " vim: shiftwidth=2 sts=2 expandtab