Mercurial > vim
annotate src/testdir/test_put.vim @ 35171:76c328389c46 default tip
Added tag v9.1.0411 for changeset ed3a90cecb19f1d38b0a9bbb9bf6ed60bace72f4
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 12 May 2024 09:30:05 +0200 |
parents | 3cacfb652766 |
children |
rev | line source |
---|---|
14202
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
1 " Tests for put commands, e.g. ":put", "p", "gp", "P", "gP", etc. |
10664
94db9c08e206
patch 8.0.0222: blockwise put on multi-byte character misplaced
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
25927
2e82629dbd90
patch 8.2.3497: put test fails when run by itself
Bram Moolenaar <Bram@vim.org>
parents:
25919
diff
changeset
|
3 source check.vim |
32288
8201b0fcea02
patch 9.0.1476: lines put in non-current window are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
32090
diff
changeset
|
4 source screendump.vim |
25927
2e82629dbd90
patch 8.2.3497: put test fails when run by itself
Bram Moolenaar <Bram@vim.org>
parents:
25919
diff
changeset
|
5 |
10664
94db9c08e206
patch 8.0.0222: blockwise put on multi-byte character misplaced
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 func Test_put_block() |
94db9c08e206
patch 8.0.0222: blockwise put on multi-byte character misplaced
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 new |
94db9c08e206
patch 8.0.0222: blockwise put on multi-byte character misplaced
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 call feedkeys("i\<C-V>u2500\<CR>x\<ESC>", 'x') |
94db9c08e206
patch 8.0.0222: blockwise put on multi-byte character misplaced
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 call feedkeys("\<C-V>y", 'x') |
94db9c08e206
patch 8.0.0222: blockwise put on multi-byte character misplaced
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 call feedkeys("gg0p", 'x') |
94db9c08e206
patch 8.0.0222: blockwise put on multi-byte character misplaced
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 call assert_equal("\u2500x", getline(1)) |
94db9c08e206
patch 8.0.0222: blockwise put on multi-byte character misplaced
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 bwipe! |
94db9c08e206
patch 8.0.0222: blockwise put on multi-byte character misplaced
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 endfunc |
10670
bce3eccea39a
patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents:
10664
diff
changeset
|
14 |
34215
8b0648002604
patch 9.1.0056: wrong number of trailing spaces inserted after blockwise put
Christian Brabandt <cb@256bit.org>
parents:
32531
diff
changeset
|
15 func Test_put_block_unicode() |
8b0648002604
patch 9.1.0056: wrong number of trailing spaces inserted after blockwise put
Christian Brabandt <cb@256bit.org>
parents:
32531
diff
changeset
|
16 new |
8b0648002604
patch 9.1.0056: wrong number of trailing spaces inserted after blockwise put
Christian Brabandt <cb@256bit.org>
parents:
32531
diff
changeset
|
17 call setreg('a', "À\nÀÀ\naaaaaaaaaaaa", "\<C-V>") |
8b0648002604
patch 9.1.0056: wrong number of trailing spaces inserted after blockwise put
Christian Brabandt <cb@256bit.org>
parents:
32531
diff
changeset
|
18 call setline(1, [' 1', ' 2', ' 3']) |
8b0648002604
patch 9.1.0056: wrong number of trailing spaces inserted after blockwise put
Christian Brabandt <cb@256bit.org>
parents:
32531
diff
changeset
|
19 exe "norm! \<C-V>jj\"ap" |
8b0648002604
patch 9.1.0056: wrong number of trailing spaces inserted after blockwise put
Christian Brabandt <cb@256bit.org>
parents:
32531
diff
changeset
|
20 let expected = ['À 1', 'ÀÀ 2', 'aaaaaaaaaaaa3'] |
8b0648002604
patch 9.1.0056: wrong number of trailing spaces inserted after blockwise put
Christian Brabandt <cb@256bit.org>
parents:
32531
diff
changeset
|
21 call assert_equal(expected, getline(1, 3)) |
8b0648002604
patch 9.1.0056: wrong number of trailing spaces inserted after blockwise put
Christian Brabandt <cb@256bit.org>
parents:
32531
diff
changeset
|
22 bw! |
8b0648002604
patch 9.1.0056: wrong number of trailing spaces inserted after blockwise put
Christian Brabandt <cb@256bit.org>
parents:
32531
diff
changeset
|
23 endfunc |
8b0648002604
patch 9.1.0056: wrong number of trailing spaces inserted after blockwise put
Christian Brabandt <cb@256bit.org>
parents:
32531
diff
changeset
|
24 |
10670
bce3eccea39a
patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents:
10664
diff
changeset
|
25 func Test_put_char_block() |
bce3eccea39a
patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents:
10664
diff
changeset
|
26 new |
bce3eccea39a
patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents:
10664
diff
changeset
|
27 call setline(1, ['Line 1', 'Line 2']) |
bce3eccea39a
patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents:
10664
diff
changeset
|
28 f Xfile_put |
bce3eccea39a
patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents:
10664
diff
changeset
|
29 " visually select both lines and put the cursor at the top of the visual |
bce3eccea39a
patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents:
10664
diff
changeset
|
30 " selection and then put the buffer name over it |
bce3eccea39a
patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents:
10664
diff
changeset
|
31 exe "norm! G0\<c-v>ke\"%p" |
bce3eccea39a
patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents:
10664
diff
changeset
|
32 call assert_equal(['Xfile_put 1', 'Xfile_put 2'], getline(1,2)) |
bce3eccea39a
patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents:
10664
diff
changeset
|
33 bw! |
bce3eccea39a
patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents:
10664
diff
changeset
|
34 endfunc |
10688
3d1872fbecc4
patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents:
10670
diff
changeset
|
35 |
3d1872fbecc4
patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents:
10670
diff
changeset
|
36 func Test_put_char_block2() |
3d1872fbecc4
patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents:
10670
diff
changeset
|
37 new |
3d1872fbecc4
patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents:
10670
diff
changeset
|
38 call setreg('a', ' one ', 'v') |
3d1872fbecc4
patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents:
10670
diff
changeset
|
39 call setline(1, ['Line 1', '', 'Line 3', '']) |
3d1872fbecc4
patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents:
10670
diff
changeset
|
40 " visually select the first 3 lines and put register a over it |
3d1872fbecc4
patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents:
10670
diff
changeset
|
41 exe "norm! ggl\<c-v>2j2l\"ap" |
21996
808edde1e97d
patch 8.2.1547: various comment problems
Bram Moolenaar <Bram@vim.org>
parents:
19625
diff
changeset
|
42 call assert_equal(['L one 1', '', 'L one 3', ''], getline(1, 4)) |
10688
3d1872fbecc4
patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents:
10670
diff
changeset
|
43 " clean up |
3d1872fbecc4
patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents:
10670
diff
changeset
|
44 bw! |
3d1872fbecc4
patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents:
10670
diff
changeset
|
45 endfunc |
11597
72b20190dce6
patch 8.0.0681: unnamed register only contains the last deleted text
Christian Brabandt <cb@256bit.org>
parents:
10688
diff
changeset
|
46 |
72b20190dce6
patch 8.0.0681: unnamed register only contains the last deleted text
Christian Brabandt <cb@256bit.org>
parents:
10688
diff
changeset
|
47 func Test_put_lines() |
72b20190dce6
patch 8.0.0681: unnamed register only contains the last deleted text
Christian Brabandt <cb@256bit.org>
parents:
10688
diff
changeset
|
48 new |
72b20190dce6
patch 8.0.0681: unnamed register only contains the last deleted text
Christian Brabandt <cb@256bit.org>
parents:
10688
diff
changeset
|
49 let a = [ getreg('a'), getregtype('a') ] |
72b20190dce6
patch 8.0.0681: unnamed register only contains the last deleted text
Christian Brabandt <cb@256bit.org>
parents:
10688
diff
changeset
|
50 call setline(1, ['Line 1', 'Line2', 'Line 3', '']) |
72b20190dce6
patch 8.0.0681: unnamed register only contains the last deleted text
Christian Brabandt <cb@256bit.org>
parents:
10688
diff
changeset
|
51 exe 'norm! gg"add"AddG""p' |
21996
808edde1e97d
patch 8.2.1547: various comment problems
Bram Moolenaar <Bram@vim.org>
parents:
19625
diff
changeset
|
52 call assert_equal(['Line 3', '', 'Line 1', 'Line2'], getline(1, '$')) |
11597
72b20190dce6
patch 8.0.0681: unnamed register only contains the last deleted text
Christian Brabandt <cb@256bit.org>
parents:
10688
diff
changeset
|
53 " clean up |
72b20190dce6
patch 8.0.0681: unnamed register only contains the last deleted text
Christian Brabandt <cb@256bit.org>
parents:
10688
diff
changeset
|
54 bw! |
18000
7a19c8d6bb9e
patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17857
diff
changeset
|
55 eval a[0]->setreg('a', a[1]) |
11597
72b20190dce6
patch 8.0.0681: unnamed register only contains the last deleted text
Christian Brabandt <cb@256bit.org>
parents:
10688
diff
changeset
|
56 endfunc |
14009
830a47e48791
patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents:
11597
diff
changeset
|
57 |
830a47e48791
patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents:
11597
diff
changeset
|
58 func Test_put_expr() |
830a47e48791
patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents:
11597
diff
changeset
|
59 new |
830a47e48791
patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents:
11597
diff
changeset
|
60 call setline(1, repeat(['A'], 6)) |
830a47e48791
patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents:
11597
diff
changeset
|
61 exec "1norm! \"=line('.')\<cr>p" |
830a47e48791
patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents:
11597
diff
changeset
|
62 norm! j0. |
830a47e48791
patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents:
11597
diff
changeset
|
63 norm! j0. |
830a47e48791
patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents:
11597
diff
changeset
|
64 exec "4norm! \"=\<cr>P" |
830a47e48791
patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents:
11597
diff
changeset
|
65 norm! j0. |
830a47e48791
patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents:
11597
diff
changeset
|
66 norm! j0. |
21996
808edde1e97d
patch 8.2.1547: various comment problems
Bram Moolenaar <Bram@vim.org>
parents:
19625
diff
changeset
|
67 call assert_equal(['A1','A2','A3','4A','5A','6A'], getline(1, '$')) |
14009
830a47e48791
patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents:
11597
diff
changeset
|
68 bw! |
830a47e48791
patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents:
11597
diff
changeset
|
69 endfunc |
14202
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
70 |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
71 func Test_put_fails_when_nomodifiable() |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
72 new |
14204
1b9f3932a130
patch 8.1.0119: failing test goes unnoticed because messages is not written
Christian Brabandt <cb@256bit.org>
parents:
14202
diff
changeset
|
73 setlocal nomodifiable |
14202
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
74 |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
75 normal! yy |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21996
diff
changeset
|
76 call assert_fails(':put', 'E21:') |
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21996
diff
changeset
|
77 call assert_fails(':put!', 'E21:') |
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21996
diff
changeset
|
78 call assert_fails(':normal! p', 'E21:') |
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21996
diff
changeset
|
79 call assert_fails(':normal! gp', 'E21:') |
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21996
diff
changeset
|
80 call assert_fails(':normal! P', 'E21:') |
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21996
diff
changeset
|
81 call assert_fails(':normal! gP', 'E21:') |
14202
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
82 |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
83 if has('mouse') |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
84 set mouse=n |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21996
diff
changeset
|
85 call assert_fails('execute "normal! \<MiddleMouse>"', 'E21:') |
14202
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
86 set mouse& |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
87 endif |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
88 |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
89 bwipeout! |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
90 endfunc |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
91 |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
92 " A bug was discovered where the Normal mode put commands (e.g., "p") would |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
93 " output duplicate error messages when invoked in a non-modifiable buffer. |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
94 func Test_put_p_errmsg_nodup() |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
95 new |
14204
1b9f3932a130
patch 8.1.0119: failing test goes unnoticed because messages is not written
Christian Brabandt <cb@256bit.org>
parents:
14202
diff
changeset
|
96 setlocal nomodifiable |
14202
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
97 |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
98 normal! yy |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
99 |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
100 func Capture_p_error() |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
101 redir => s:p_err |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
102 normal! p |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
103 redir END |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
104 endfunc |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
105 |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
106 silent! call Capture_p_error() |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
107 |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
108 " Error message output within a function should be three lines (the function |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
109 " name, the line number, and the error message). |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
110 call assert_equal(3, count(s:p_err, "\n")) |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
111 |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
112 delfunction Capture_p_error |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
113 bwipeout! |
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
14009
diff
changeset
|
114 endfunc |
16742
75b5d77bbbab
patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
115 |
75b5d77bbbab
patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
116 func Test_put_p_indent_visual() |
75b5d77bbbab
patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
117 new |
75b5d77bbbab
patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
118 call setline(1, ['select this text', 'select that text']) |
75b5d77bbbab
patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
119 " yank "that" from the second line |
75b5d77bbbab
patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
120 normal 2Gwvey |
75b5d77bbbab
patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
121 " select "this" in the first line and put |
75b5d77bbbab
patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
122 normal k0wve[p |
75b5d77bbbab
patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
123 call assert_equal('select that text', getline(1)) |
75b5d77bbbab
patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
124 call assert_equal('select that text', getline(2)) |
75b5d77bbbab
patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
125 bwipe! |
75b5d77bbbab
patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
126 endfunc |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18000
diff
changeset
|
127 |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18000
diff
changeset
|
128 " Test for deleting all the contents of a buffer with a put |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18000
diff
changeset
|
129 func Test_put_visual_delete_all_lines() |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18000
diff
changeset
|
130 new |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18000
diff
changeset
|
131 call setline(1, ['one', 'two', 'three']) |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18000
diff
changeset
|
132 let @r = '' |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18000
diff
changeset
|
133 normal! VG"rgp |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18000
diff
changeset
|
134 call assert_equal(1, line('$')) |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18000
diff
changeset
|
135 close! |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18000
diff
changeset
|
136 endfunc |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18000
diff
changeset
|
137 |
25840
8ff483b86d9b
patch 8.2.3454: using a count with "gp" leave cursor in wrong position
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
138 func Test_gp_with_count_leaves_cursor_at_end() |
8ff483b86d9b
patch 8.2.3454: using a count with "gp" leave cursor in wrong position
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
139 new |
8ff483b86d9b
patch 8.2.3454: using a count with "gp" leave cursor in wrong position
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
140 call setline(1, '<---->') |
8ff483b86d9b
patch 8.2.3454: using a count with "gp" leave cursor in wrong position
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
141 call setreg('@', "foo\nbar", 'c') |
25842
196f75cf6983
patch 8.2.3455: using a count with "gp" leaves '] in wrong position
Bram Moolenaar <Bram@vim.org>
parents:
25840
diff
changeset
|
142 normal 1G3|3gp |
196f75cf6983
patch 8.2.3455: using a count with "gp" leaves '] in wrong position
Bram Moolenaar <Bram@vim.org>
parents:
25840
diff
changeset
|
143 call assert_equal([0, 4, 4, 0], getpos(".")) |
196f75cf6983
patch 8.2.3455: using a count with "gp" leaves '] in wrong position
Bram Moolenaar <Bram@vim.org>
parents:
25840
diff
changeset
|
144 call assert_equal(['<--foo', 'barfoo', 'barfoo', 'bar-->'], getline(1, '$')) |
196f75cf6983
patch 8.2.3455: using a count with "gp" leaves '] in wrong position
Bram Moolenaar <Bram@vim.org>
parents:
25840
diff
changeset
|
145 call assert_equal([0, 4, 3, 0], getpos("']")) |
25840
8ff483b86d9b
patch 8.2.3454: using a count with "gp" leave cursor in wrong position
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
146 |
8ff483b86d9b
patch 8.2.3454: using a count with "gp" leave cursor in wrong position
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
147 bwipe! |
8ff483b86d9b
patch 8.2.3454: using a count with "gp" leave cursor in wrong position
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
148 endfunc |
8ff483b86d9b
patch 8.2.3454: using a count with "gp" leave cursor in wrong position
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
149 |
26012
b863efc63397
patch 8.2.3540: the mark '] is wrong after put with a count
Bram Moolenaar <Bram@vim.org>
parents:
25927
diff
changeset
|
150 func Test_p_with_count_leaves_mark_at_end() |
b863efc63397
patch 8.2.3540: the mark '] is wrong after put with a count
Bram Moolenaar <Bram@vim.org>
parents:
25927
diff
changeset
|
151 new |
b863efc63397
patch 8.2.3540: the mark '] is wrong after put with a count
Bram Moolenaar <Bram@vim.org>
parents:
25927
diff
changeset
|
152 call setline(1, '<---->') |
b863efc63397
patch 8.2.3540: the mark '] is wrong after put with a count
Bram Moolenaar <Bram@vim.org>
parents:
25927
diff
changeset
|
153 call setreg('@', "start\nend", 'c') |
b863efc63397
patch 8.2.3540: the mark '] is wrong after put with a count
Bram Moolenaar <Bram@vim.org>
parents:
25927
diff
changeset
|
154 normal 1G3|3p |
b863efc63397
patch 8.2.3540: the mark '] is wrong after put with a count
Bram Moolenaar <Bram@vim.org>
parents:
25927
diff
changeset
|
155 call assert_equal([0, 1, 4, 0], getpos(".")) |
b863efc63397
patch 8.2.3540: the mark '] is wrong after put with a count
Bram Moolenaar <Bram@vim.org>
parents:
25927
diff
changeset
|
156 call assert_equal(['<--start', 'endstart', 'endstart', 'end-->'], getline(1, '$')) |
b863efc63397
patch 8.2.3540: the mark '] is wrong after put with a count
Bram Moolenaar <Bram@vim.org>
parents:
25927
diff
changeset
|
157 call assert_equal([0, 4, 3, 0], getpos("']")) |
b863efc63397
patch 8.2.3540: the mark '] is wrong after put with a count
Bram Moolenaar <Bram@vim.org>
parents:
25927
diff
changeset
|
158 |
b863efc63397
patch 8.2.3540: the mark '] is wrong after put with a count
Bram Moolenaar <Bram@vim.org>
parents:
25927
diff
changeset
|
159 bwipe! |
b863efc63397
patch 8.2.3540: the mark '] is wrong after put with a count
Bram Moolenaar <Bram@vim.org>
parents:
25927
diff
changeset
|
160 endfunc |
b863efc63397
patch 8.2.3540: the mark '] is wrong after put with a count
Bram Moolenaar <Bram@vim.org>
parents:
25927
diff
changeset
|
161 |
25919
db5b5c38d222
patch 8.2.3493: large count test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
25917
diff
changeset
|
162 func Test_very_large_count() |
26137
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
163 new |
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
164 " total put-length (21474837 * 100) brings 32 bit int overflow |
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
165 let @" = repeat('x', 100) |
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
166 call assert_fails('norm 21474837p', 'E1240:') |
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
167 bwipe! |
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
168 endfunc |
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
169 |
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
170 func Test_very_large_count_64bit() |
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
171 if v:sizeoflong < 8 |
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
172 throw 'Skipped: only works with 64 bit long ints' |
26087
945bdfc3c00f
patch 8.2.3577: overflow check fails with 32 ints
Bram Moolenaar <Bram@vim.org>
parents:
26079
diff
changeset
|
173 endif |
945bdfc3c00f
patch 8.2.3577: overflow check fails with 32 ints
Bram Moolenaar <Bram@vim.org>
parents:
26079
diff
changeset
|
174 |
25917
79a5c8238a5d
patch 8.2.3492: crash when pasting too many times
Bram Moolenaar <Bram@vim.org>
parents:
25842
diff
changeset
|
175 new |
26260
164db42130ec
patch 8.2.3661: test for put with large count fails
Bram Moolenaar <Bram@vim.org>
parents:
26137
diff
changeset
|
176 let @" = repeat('x', 100) |
164db42130ec
patch 8.2.3661: test for put with large count fails
Bram Moolenaar <Bram@vim.org>
parents:
26137
diff
changeset
|
177 call assert_fails('norm 999999999p', 'E1240:') |
25917
79a5c8238a5d
patch 8.2.3492: crash when pasting too many times
Bram Moolenaar <Bram@vim.org>
parents:
25842
diff
changeset
|
178 bwipe! |
79a5c8238a5d
patch 8.2.3492: crash when pasting too many times
Bram Moolenaar <Bram@vim.org>
parents:
25842
diff
changeset
|
179 endfunc |
79a5c8238a5d
patch 8.2.3492: crash when pasting too many times
Bram Moolenaar <Bram@vim.org>
parents:
25842
diff
changeset
|
180 |
26137
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
181 func Test_very_large_count_block() |
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
182 new |
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
183 " total put-length (21474837 * 100) brings 32 bit int overflow |
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
184 call setline(1, repeat('x', 100)) |
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
185 exe "norm \<C-V>99ly" |
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
186 call assert_fails('norm 21474837p', 'E1240:') |
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
187 bwipe! |
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
188 endfunc |
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
189 |
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
190 func Test_very_large_count_block_64bit() |
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
191 if v:sizeoflong < 8 |
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
192 throw 'Skipped: only works with 64 bit long ints' |
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
193 endif |
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
194 |
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
195 new |
26260
164db42130ec
patch 8.2.3661: test for put with large count fails
Bram Moolenaar <Bram@vim.org>
parents:
26137
diff
changeset
|
196 call setline(1, repeat('x', 100)) |
164db42130ec
patch 8.2.3661: test for put with large count fails
Bram Moolenaar <Bram@vim.org>
parents:
26137
diff
changeset
|
197 exe "norm \<C-V>$y" |
164db42130ec
patch 8.2.3661: test for put with large count fails
Bram Moolenaar <Bram@vim.org>
parents:
26137
diff
changeset
|
198 call assert_fails('norm 999999999p', 'E1240:') |
26137
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
199 bwipe! |
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
200 endfunc |
14a55d1520f2
patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents:
26096
diff
changeset
|
201 |
26096
e353ace59e62
patch 8.2.3581: reading character past end of line
Bram Moolenaar <Bram@vim.org>
parents:
26087
diff
changeset
|
202 func Test_put_above_first_line() |
e353ace59e62
patch 8.2.3581: reading character past end of line
Bram Moolenaar <Bram@vim.org>
parents:
26087
diff
changeset
|
203 new |
e353ace59e62
patch 8.2.3581: reading character past end of line
Bram Moolenaar <Bram@vim.org>
parents:
26087
diff
changeset
|
204 let @" = 'text' |
e353ace59e62
patch 8.2.3581: reading character past end of line
Bram Moolenaar <Bram@vim.org>
parents:
26087
diff
changeset
|
205 silent! normal 0o00 |
e353ace59e62
patch 8.2.3581: reading character past end of line
Bram Moolenaar <Bram@vim.org>
parents:
26087
diff
changeset
|
206 0put |
e353ace59e62
patch 8.2.3581: reading character past end of line
Bram Moolenaar <Bram@vim.org>
parents:
26087
diff
changeset
|
207 call assert_equal('text', getline(1)) |
e353ace59e62
patch 8.2.3581: reading character past end of line
Bram Moolenaar <Bram@vim.org>
parents:
26087
diff
changeset
|
208 bwipe! |
e353ace59e62
patch 8.2.3581: reading character past end of line
Bram Moolenaar <Bram@vim.org>
parents:
26087
diff
changeset
|
209 endfunc |
e353ace59e62
patch 8.2.3581: reading character past end of line
Bram Moolenaar <Bram@vim.org>
parents:
26087
diff
changeset
|
210 |
26292
b79f122c6bd8
patch 8.2.3677: after a put the '] mark is on the last byte
Bram Moolenaar <Bram@vim.org>
parents:
26260
diff
changeset
|
211 func Test_multibyte_op_end_mark() |
b79f122c6bd8
patch 8.2.3677: after a put the '] mark is on the last byte
Bram Moolenaar <Bram@vim.org>
parents:
26260
diff
changeset
|
212 new |
b79f122c6bd8
patch 8.2.3677: after a put the '] mark is on the last byte
Bram Moolenaar <Bram@vim.org>
parents:
26260
diff
changeset
|
213 call setline(1, 'тест') |
b79f122c6bd8
patch 8.2.3677: after a put the '] mark is on the last byte
Bram Moolenaar <Bram@vim.org>
parents:
26260
diff
changeset
|
214 normal viwdp |
b79f122c6bd8
patch 8.2.3677: after a put the '] mark is on the last byte
Bram Moolenaar <Bram@vim.org>
parents:
26260
diff
changeset
|
215 call assert_equal([0, 1, 7, 0], getpos("'>")) |
b79f122c6bd8
patch 8.2.3677: after a put the '] mark is on the last byte
Bram Moolenaar <Bram@vim.org>
parents:
26260
diff
changeset
|
216 call assert_equal([0, 1, 7, 0], getpos("']")) |
b79f122c6bd8
patch 8.2.3677: after a put the '] mark is on the last byte
Bram Moolenaar <Bram@vim.org>
parents:
26260
diff
changeset
|
217 |
b79f122c6bd8
patch 8.2.3677: after a put the '] mark is on the last byte
Bram Moolenaar <Bram@vim.org>
parents:
26260
diff
changeset
|
218 normal Vyp |
26881
fb67cd7d30a7
patch 8.2.3969: value of MAXCOL not available in Vim script
Bram Moolenaar <Bram@vim.org>
parents:
26292
diff
changeset
|
219 call assert_equal([0, 1, v:maxcol, 0], getpos("'>")) |
26292
b79f122c6bd8
patch 8.2.3677: after a put the '] mark is on the last byte
Bram Moolenaar <Bram@vim.org>
parents:
26260
diff
changeset
|
220 call assert_equal([0, 2, 7, 0], getpos("']")) |
b79f122c6bd8
patch 8.2.3677: after a put the '] mark is on the last byte
Bram Moolenaar <Bram@vim.org>
parents:
26260
diff
changeset
|
221 bwipe! |
b79f122c6bd8
patch 8.2.3677: after a put the '] mark is on the last byte
Bram Moolenaar <Bram@vim.org>
parents:
26260
diff
changeset
|
222 endfunc |
b79f122c6bd8
patch 8.2.3677: after a put the '] mark is on the last byte
Bram Moolenaar <Bram@vim.org>
parents:
26260
diff
changeset
|
223 |
28988
e6f486df5cc9
patch 8.2.5016: access before start of text with a put command
Bram Moolenaar <Bram@vim.org>
parents:
26881
diff
changeset
|
224 " this was putting a mark before the start of a line |
e6f486df5cc9
patch 8.2.5016: access before start of text with a put command
Bram Moolenaar <Bram@vim.org>
parents:
26881
diff
changeset
|
225 func Test_put_empty_register() |
e6f486df5cc9
patch 8.2.5016: access before start of text with a put command
Bram Moolenaar <Bram@vim.org>
parents:
26881
diff
changeset
|
226 new |
e6f486df5cc9
patch 8.2.5016: access before start of text with a put command
Bram Moolenaar <Bram@vim.org>
parents:
26881
diff
changeset
|
227 norm yy |
e6f486df5cc9
patch 8.2.5016: access before start of text with a put command
Bram Moolenaar <Bram@vim.org>
parents:
26881
diff
changeset
|
228 norm [Pi00ggv)s0 |
e6f486df5cc9
patch 8.2.5016: access before start of text with a put command
Bram Moolenaar <Bram@vim.org>
parents:
26881
diff
changeset
|
229 sil! norm [P |
e6f486df5cc9
patch 8.2.5016: access before start of text with a put command
Bram Moolenaar <Bram@vim.org>
parents:
26881
diff
changeset
|
230 bwipe! |
e6f486df5cc9
patch 8.2.5016: access before start of text with a put command
Bram Moolenaar <Bram@vim.org>
parents:
26881
diff
changeset
|
231 endfunc |
e6f486df5cc9
patch 8.2.5016: access before start of text with a put command
Bram Moolenaar <Bram@vim.org>
parents:
26881
diff
changeset
|
232 |
29336
575bc8eaa593
patch 9.0.0011: reading beyond the end of the line with put command
Bram Moolenaar <Bram@vim.org>
parents:
28988
diff
changeset
|
233 " this was putting the end mark after the end of the line |
575bc8eaa593
patch 9.0.0011: reading beyond the end of the line with put command
Bram Moolenaar <Bram@vim.org>
parents:
28988
diff
changeset
|
234 func Test_put_visual_mode() |
575bc8eaa593
patch 9.0.0011: reading beyond the end of the line with put command
Bram Moolenaar <Bram@vim.org>
parents:
28988
diff
changeset
|
235 edit! SomeNewBuffer |
575bc8eaa593
patch 9.0.0011: reading beyond the end of the line with put command
Bram Moolenaar <Bram@vim.org>
parents:
28988
diff
changeset
|
236 set selection=exclusive |
575bc8eaa593
patch 9.0.0011: reading beyond the end of the line with put command
Bram Moolenaar <Bram@vim.org>
parents:
28988
diff
changeset
|
237 exe "norm o\t" |
575bc8eaa593
patch 9.0.0011: reading beyond the end of the line with put command
Bram Moolenaar <Bram@vim.org>
parents:
28988
diff
changeset
|
238 m0 |
575bc8eaa593
patch 9.0.0011: reading beyond the end of the line with put command
Bram Moolenaar <Bram@vim.org>
parents:
28988
diff
changeset
|
239 sil! norm p p |
575bc8eaa593
patch 9.0.0011: reading beyond the end of the line with put command
Bram Moolenaar <Bram@vim.org>
parents:
28988
diff
changeset
|
240 |
575bc8eaa593
patch 9.0.0011: reading beyond the end of the line with put command
Bram Moolenaar <Bram@vim.org>
parents:
28988
diff
changeset
|
241 bwipe! |
575bc8eaa593
patch 9.0.0011: reading beyond the end of the line with put command
Bram Moolenaar <Bram@vim.org>
parents:
28988
diff
changeset
|
242 set selection& |
575bc8eaa593
patch 9.0.0011: reading beyond the end of the line with put command
Bram Moolenaar <Bram@vim.org>
parents:
28988
diff
changeset
|
243 endfunc |
575bc8eaa593
patch 9.0.0011: reading beyond the end of the line with put command
Bram Moolenaar <Bram@vim.org>
parents:
28988
diff
changeset
|
244 |
32090
327f8a3e0040
patch 9.0.1376: accessing invalid memory with put in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents:
29336
diff
changeset
|
245 func Test_put_visual_block_mode() |
327f8a3e0040
patch 9.0.1376: accessing invalid memory with put in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents:
29336
diff
changeset
|
246 enew |
327f8a3e0040
patch 9.0.1376: accessing invalid memory with put in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents:
29336
diff
changeset
|
247 exe "norm 0R\<CR>\<C-C>V" |
327f8a3e0040
patch 9.0.1376: accessing invalid memory with put in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents:
29336
diff
changeset
|
248 sil exe "norm \<C-V>c \<MiddleDrag>" |
327f8a3e0040
patch 9.0.1376: accessing invalid memory with put in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents:
29336
diff
changeset
|
249 set ve=all |
327f8a3e0040
patch 9.0.1376: accessing invalid memory with put in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents:
29336
diff
changeset
|
250 sil norm vz=p |
327f8a3e0040
patch 9.0.1376: accessing invalid memory with put in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents:
29336
diff
changeset
|
251 |
327f8a3e0040
patch 9.0.1376: accessing invalid memory with put in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents:
29336
diff
changeset
|
252 bwipe! |
327f8a3e0040
patch 9.0.1376: accessing invalid memory with put in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents:
29336
diff
changeset
|
253 set ve= |
327f8a3e0040
patch 9.0.1376: accessing invalid memory with put in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents:
29336
diff
changeset
|
254 endfunc |
327f8a3e0040
patch 9.0.1376: accessing invalid memory with put in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents:
29336
diff
changeset
|
255 |
32288
8201b0fcea02
patch 9.0.1476: lines put in non-current window are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
32090
diff
changeset
|
256 func Test_put_other_window() |
8201b0fcea02
patch 9.0.1476: lines put in non-current window are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
32090
diff
changeset
|
257 CheckRunVimInTerminal |
8201b0fcea02
patch 9.0.1476: lines put in non-current window are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
32090
diff
changeset
|
258 |
8201b0fcea02
patch 9.0.1476: lines put in non-current window are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
32090
diff
changeset
|
259 let lines =<< trim END |
8201b0fcea02
patch 9.0.1476: lines put in non-current window are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
32090
diff
changeset
|
260 40vsplit |
8201b0fcea02
patch 9.0.1476: lines put in non-current window are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
32090
diff
changeset
|
261 0put ='some text at the top' |
8201b0fcea02
patch 9.0.1476: lines put in non-current window are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
32090
diff
changeset
|
262 put =' one more text' |
8201b0fcea02
patch 9.0.1476: lines put in non-current window are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
32090
diff
changeset
|
263 put =' two more text' |
8201b0fcea02
patch 9.0.1476: lines put in non-current window are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
32090
diff
changeset
|
264 put =' three more text' |
8201b0fcea02
patch 9.0.1476: lines put in non-current window are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
32090
diff
changeset
|
265 put =' four more text' |
8201b0fcea02
patch 9.0.1476: lines put in non-current window are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
32090
diff
changeset
|
266 END |
8201b0fcea02
patch 9.0.1476: lines put in non-current window are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
32090
diff
changeset
|
267 call writefile(lines, 'Xtest_put_other', 'D') |
8201b0fcea02
patch 9.0.1476: lines put in non-current window are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
32090
diff
changeset
|
268 let buf = RunVimInTerminal('-S Xtest_put_other', #{rows: 10}) |
8201b0fcea02
patch 9.0.1476: lines put in non-current window are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
32090
diff
changeset
|
269 |
8201b0fcea02
patch 9.0.1476: lines put in non-current window are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
32090
diff
changeset
|
270 call VerifyScreenDump(buf, 'Test_put_other_window_1', {}) |
8201b0fcea02
patch 9.0.1476: lines put in non-current window are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
32090
diff
changeset
|
271 |
8201b0fcea02
patch 9.0.1476: lines put in non-current window are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
32090
diff
changeset
|
272 call StopVimInTerminal(buf) |
8201b0fcea02
patch 9.0.1476: lines put in non-current window are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
32090
diff
changeset
|
273 endfunc |
8201b0fcea02
patch 9.0.1476: lines put in non-current window are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
32090
diff
changeset
|
274 |
32531
c8b28054caec
patch 9.0.1597: cursor ends up below the window after a put
Bram Moolenaar <Bram@vim.org>
parents:
32288
diff
changeset
|
275 func Test_put_in_last_displayed_line() |
c8b28054caec
patch 9.0.1597: cursor ends up below the window after a put
Bram Moolenaar <Bram@vim.org>
parents:
32288
diff
changeset
|
276 CheckRunVimInTerminal |
c8b28054caec
patch 9.0.1597: cursor ends up below the window after a put
Bram Moolenaar <Bram@vim.org>
parents:
32288
diff
changeset
|
277 |
c8b28054caec
patch 9.0.1597: cursor ends up below the window after a put
Bram Moolenaar <Bram@vim.org>
parents:
32288
diff
changeset
|
278 let lines =<< trim END |
c8b28054caec
patch 9.0.1597: cursor ends up below the window after a put
Bram Moolenaar <Bram@vim.org>
parents:
32288
diff
changeset
|
279 vim9script |
c8b28054caec
patch 9.0.1597: cursor ends up below the window after a put
Bram Moolenaar <Bram@vim.org>
parents:
32288
diff
changeset
|
280 autocmd CursorMoved * eval line('w$') |
c8b28054caec
patch 9.0.1597: cursor ends up below the window after a put
Bram Moolenaar <Bram@vim.org>
parents:
32288
diff
changeset
|
281 @a = 'x'->repeat(&columns * 2 - 2) |
c8b28054caec
patch 9.0.1597: cursor ends up below the window after a put
Bram Moolenaar <Bram@vim.org>
parents:
32288
diff
changeset
|
282 range(&lines)->setline(1) |
c8b28054caec
patch 9.0.1597: cursor ends up below the window after a put
Bram Moolenaar <Bram@vim.org>
parents:
32288
diff
changeset
|
283 feedkeys('G"ap') |
c8b28054caec
patch 9.0.1597: cursor ends up below the window after a put
Bram Moolenaar <Bram@vim.org>
parents:
32288
diff
changeset
|
284 END |
c8b28054caec
patch 9.0.1597: cursor ends up below the window after a put
Bram Moolenaar <Bram@vim.org>
parents:
32288
diff
changeset
|
285 call writefile(lines, 'Xtest_put_last_line', 'D') |
c8b28054caec
patch 9.0.1597: cursor ends up below the window after a put
Bram Moolenaar <Bram@vim.org>
parents:
32288
diff
changeset
|
286 let buf = RunVimInTerminal('-S Xtest_put_last_line', #{rows: 10}) |
c8b28054caec
patch 9.0.1597: cursor ends up below the window after a put
Bram Moolenaar <Bram@vim.org>
parents:
32288
diff
changeset
|
287 |
c8b28054caec
patch 9.0.1597: cursor ends up below the window after a put
Bram Moolenaar <Bram@vim.org>
parents:
32288
diff
changeset
|
288 call VerifyScreenDump(buf, 'Test_put_in_last_displayed_line_1', {}) |
c8b28054caec
patch 9.0.1597: cursor ends up below the window after a put
Bram Moolenaar <Bram@vim.org>
parents:
32288
diff
changeset
|
289 |
c8b28054caec
patch 9.0.1597: cursor ends up below the window after a put
Bram Moolenaar <Bram@vim.org>
parents:
32288
diff
changeset
|
290 call StopVimInTerminal(buf) |
c8b28054caec
patch 9.0.1597: cursor ends up below the window after a put
Bram Moolenaar <Bram@vim.org>
parents:
32288
diff
changeset
|
291 endfunc |
c8b28054caec
patch 9.0.1597: cursor ends up below the window after a put
Bram Moolenaar <Bram@vim.org>
parents:
32288
diff
changeset
|
292 |
34448
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
293 func Test_put_visual_replace_whole_fold() |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
294 new |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
295 let lines = repeat(['{{{1', 'foo', 'bar', ''], 2) |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
296 call setline(1, lines) |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
297 setlocal foldmethod=marker |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
298 call setreg('"', 'baz') |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
299 call setreg('1', '') |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
300 normal! Vp |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
301 call assert_equal("{{{1\nfoo\nbar\n\n", getreg('1')) |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
302 call assert_equal(['baz', '{{{1', 'foo', 'bar', ''], getline(1, '$')) |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
303 |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
304 bwipe! |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
305 endfunc |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
306 |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
307 func Test_put_visual_replace_fold_marker() |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
308 new |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
309 let lines = repeat(['{{{1', 'foo', 'bar', ''], 4) |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
310 call setline(1, lines) |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
311 setlocal foldmethod=marker |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
312 normal! Gkzo |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
313 call setreg('"', '{{{1') |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
314 call setreg('1', '') |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
315 normal! Vp |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
316 call assert_equal("{{{1\n", getreg('1')) |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
317 call assert_equal(lines, getline(1, '$')) |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
318 |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
319 bwipe! |
e21d2759a5c2
patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker
Christian Brabandt <cb@256bit.org>
parents:
34215
diff
changeset
|
320 endfunc |
25917
79a5c8238a5d
patch 8.2.3492: crash when pasting too many times
Bram Moolenaar <Bram@vim.org>
parents:
25842
diff
changeset
|
321 |
34944
1e6f45f5ca23
patch 9.1.0329: String interpolation fails for Dict type
Christian Brabandt <cb@256bit.org>
parents:
34448
diff
changeset
|
322 func Test_put_dict() |
1e6f45f5ca23
patch 9.1.0329: String interpolation fails for Dict type
Christian Brabandt <cb@256bit.org>
parents:
34448
diff
changeset
|
323 new |
1e6f45f5ca23
patch 9.1.0329: String interpolation fails for Dict type
Christian Brabandt <cb@256bit.org>
parents:
34448
diff
changeset
|
324 let d = #{a: #{b: 'abc'}, c: [1, 2], d: 0z10} |
1e6f45f5ca23
patch 9.1.0329: String interpolation fails for Dict type
Christian Brabandt <cb@256bit.org>
parents:
34448
diff
changeset
|
325 put! =d |
1e6f45f5ca23
patch 9.1.0329: String interpolation fails for Dict type
Christian Brabandt <cb@256bit.org>
parents:
34448
diff
changeset
|
326 call assert_equal(["{'a': {'b': 'abc'}, 'c': [1, 2], 'd': 0z10}", ''], |
1e6f45f5ca23
patch 9.1.0329: String interpolation fails for Dict type
Christian Brabandt <cb@256bit.org>
parents:
34448
diff
changeset
|
327 \ getline(1, '$')) |
1e6f45f5ca23
patch 9.1.0329: String interpolation fails for Dict type
Christian Brabandt <cb@256bit.org>
parents:
34448
diff
changeset
|
328 bw! |
1e6f45f5ca23
patch 9.1.0329: String interpolation fails for Dict type
Christian Brabandt <cb@256bit.org>
parents:
34448
diff
changeset
|
329 endfunc |
1e6f45f5ca23
patch 9.1.0329: String interpolation fails for Dict type
Christian Brabandt <cb@256bit.org>
parents:
34448
diff
changeset
|
330 |
34957
3cacfb652766
patch 9.1.0335: String interpolation fails for List type
Christian Brabandt <cb@256bit.org>
parents:
34944
diff
changeset
|
331 func Test_put_list() |
3cacfb652766
patch 9.1.0335: String interpolation fails for List type
Christian Brabandt <cb@256bit.org>
parents:
34944
diff
changeset
|
332 new |
3cacfb652766
patch 9.1.0335: String interpolation fails for List type
Christian Brabandt <cb@256bit.org>
parents:
34944
diff
changeset
|
333 let l = ['a', 'b', 'c'] |
3cacfb652766
patch 9.1.0335: String interpolation fails for List type
Christian Brabandt <cb@256bit.org>
parents:
34944
diff
changeset
|
334 put! =l |
3cacfb652766
patch 9.1.0335: String interpolation fails for List type
Christian Brabandt <cb@256bit.org>
parents:
34944
diff
changeset
|
335 call assert_equal(['a', 'b', 'c', ''], getline(1, '$')) |
3cacfb652766
patch 9.1.0335: String interpolation fails for List type
Christian Brabandt <cb@256bit.org>
parents:
34944
diff
changeset
|
336 bw! |
3cacfb652766
patch 9.1.0335: String interpolation fails for List type
Christian Brabandt <cb@256bit.org>
parents:
34944
diff
changeset
|
337 endfunc |
3cacfb652766
patch 9.1.0335: String interpolation fails for List type
Christian Brabandt <cb@256bit.org>
parents:
34944
diff
changeset
|
338 |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18000
diff
changeset
|
339 " vim: shiftwidth=2 sts=2 expandtab |