annotate src/testdir/test_put.vim @ 27352:2bec1976362c v8.2.4204

patch 8.2.4204: screenpos() has non-zero row for invisible text Commit: https://github.com/vim/vim/commit/7924a17791217d50be5a91989a9641bf68e7a735 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jan 24 16:15:15 2022 +0000 patch 8.2.4204: screenpos() has non-zero row for invisible text Problem: screenpos() has non-zero row for invisible text. Solution: Only add the window row when the text is visible. (closes https://github.com/vim/vim/issues/9618)
author Bram Moolenaar <Bram@vim.org>
date Mon, 24 Jan 2022 17:30:05 +0100
parents fb67cd7d30a7
children e6f486df5cc9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
2e82629dbd90 patch 8.2.3497: put test fails when run by itself
Bram Moolenaar <Bram@vim.org>
parents: 25919
diff changeset
4
10664
94db9c08e206 patch 8.0.0222: blockwise put on multi-byte character misplaced
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 func Test_put_block()
94db9c08e206 patch 8.0.0222: blockwise put on multi-byte character misplaced
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 new
94db9c08e206 patch 8.0.0222: blockwise put on multi-byte character misplaced
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 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
8 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
9 call feedkeys("gg0p", 'x')
94db9c08e206 patch 8.0.0222: blockwise put on multi-byte character misplaced
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 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
11 bwipe!
94db9c08e206 patch 8.0.0222: blockwise put on multi-byte character misplaced
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 endfunc
10670
bce3eccea39a patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents: 10664
diff changeset
13
bce3eccea39a patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents: 10664
diff changeset
14 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
15 new
bce3eccea39a patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents: 10664
diff changeset
16 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
17 f Xfile_put
bce3eccea39a patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents: 10664
diff changeset
18 " 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
19 " 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
20 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
21 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
22 bw!
bce3eccea39a patch 8.0.0225: put in Visual block mode terminates early
Christian Brabandt <cb@256bit.org>
parents: 10664
diff changeset
23 endfunc
10688
3d1872fbecc4 patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10670
diff changeset
24
3d1872fbecc4 patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10670
diff changeset
25 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
26 new
3d1872fbecc4 patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10670
diff changeset
27 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
28 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
29 " 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
30 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
31 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
32 " clean up
3d1872fbecc4 patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10670
diff changeset
33 bw!
3d1872fbecc4 patch 8.0.0234: crash when using put in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10670
diff changeset
34 endfunc
11597
72b20190dce6 patch 8.0.0681: unnamed register only contains the last deleted text
Christian Brabandt <cb@256bit.org>
parents: 10688
diff changeset
35
72b20190dce6 patch 8.0.0681: unnamed register only contains the last deleted text
Christian Brabandt <cb@256bit.org>
parents: 10688
diff changeset
36 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
37 new
72b20190dce6 patch 8.0.0681: unnamed register only contains the last deleted text
Christian Brabandt <cb@256bit.org>
parents: 10688
diff changeset
38 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
39 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
40 exe 'norm! gg"add"AddG""p'
21996
808edde1e97d patch 8.2.1547: various comment problems
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
41 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
42 " clean up
72b20190dce6 patch 8.0.0681: unnamed register only contains the last deleted text
Christian Brabandt <cb@256bit.org>
parents: 10688
diff changeset
43 bw!
18000
7a19c8d6bb9e patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17857
diff changeset
44 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
45 endfunc
14009
830a47e48791 patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents: 11597
diff changeset
46
830a47e48791 patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents: 11597
diff changeset
47 func Test_put_expr()
830a47e48791 patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents: 11597
diff changeset
48 new
830a47e48791 patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents: 11597
diff changeset
49 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
50 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
51 norm! j0.
830a47e48791 patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents: 11597
diff changeset
52 norm! j0.
830a47e48791 patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents: 11597
diff changeset
53 exec "4norm! \"=\<cr>P"
830a47e48791 patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents: 11597
diff changeset
54 norm! j0.
830a47e48791 patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents: 11597
diff changeset
55 norm! j0.
21996
808edde1e97d patch 8.2.1547: various comment problems
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
56 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
57 bw!
830a47e48791 patch 8.1.0022: repeating put from expression register fails
Christian Brabandt <cb@256bit.org>
parents: 11597
diff changeset
58 endfunc
14202
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
59
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
60 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
61 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
62 setlocal nomodifiable
14202
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
63
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
64 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
65 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
66 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
67 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
68 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
69 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
70 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
71
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
72 if has('mouse')
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
73 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
74 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
75 set mouse&
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
76 endif
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
77
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
78 bwipeout!
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
79 endfunc
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
80
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
81 " 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
82 " 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
83 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
84 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
85 setlocal nomodifiable
14202
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
86
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
87 normal! yy
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 func Capture_p_error()
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
90 redir => s:p_err
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
91 normal! p
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
92 redir END
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
93 endfunc
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
94
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
95 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
96
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
97 " 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
98 " 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
99 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
100
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
101 delfunction Capture_p_error
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
102 bwipeout!
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 14009
diff changeset
103 endfunc
16742
75b5d77bbbab patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
104
75b5d77bbbab patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
105 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
106 new
75b5d77bbbab patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
107 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
108 " 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
109 normal 2Gwvey
75b5d77bbbab patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
110 " 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
111 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
112 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
113 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
114 bwipe!
75b5d77bbbab patch 8.1.1373: "[p" in Visual mode puts in wrong line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
115 endfunc
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
116
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
117 " 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
118 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
119 new
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
120 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
121 let @r = ''
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
122 normal! VG"rgp
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
123 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
124 close!
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
125 endfunc
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
126
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
127 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
128 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
129 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
130 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
131 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
132 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
133 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
134 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
135
8ff483b86d9b patch 8.2.3454: using a count with "gp" leave cursor in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
136 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
137 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
138
26012
b863efc63397 patch 8.2.3540: the mark '] is wrong after put with a count
Bram Moolenaar <Bram@vim.org>
parents: 25927
diff changeset
139 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
140 new
b863efc63397 patch 8.2.3540: the mark '] is wrong after put with a count
Bram Moolenaar <Bram@vim.org>
parents: 25927
diff changeset
141 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
142 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
143 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
144 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
145 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
146 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
147
b863efc63397 patch 8.2.3540: the mark '] is wrong after put with a count
Bram Moolenaar <Bram@vim.org>
parents: 25927
diff changeset
148 bwipe!
b863efc63397 patch 8.2.3540: the mark '] is wrong after put with a count
Bram Moolenaar <Bram@vim.org>
parents: 25927
diff changeset
149 endfunc
b863efc63397 patch 8.2.3540: the mark '] is wrong after put with a count
Bram Moolenaar <Bram@vim.org>
parents: 25927
diff changeset
150
25919
db5b5c38d222 patch 8.2.3493: large count test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 25917
diff changeset
151 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
152 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
153 " 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
154 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
155 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
156 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
157 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
158
14a55d1520f2 patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents: 26096
diff changeset
159 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
160 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
161 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
162 endif
945bdfc3c00f patch 8.2.3577: overflow check fails with 32 ints
Bram Moolenaar <Bram@vim.org>
parents: 26079
diff changeset
163
25917
79a5c8238a5d patch 8.2.3492: crash when pasting too many times
Bram Moolenaar <Bram@vim.org>
parents: 25842
diff changeset
164 new
26260
164db42130ec patch 8.2.3661: test for put with large count fails
Bram Moolenaar <Bram@vim.org>
parents: 26137
diff changeset
165 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
166 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
167 bwipe!
79a5c8238a5d patch 8.2.3492: crash when pasting too many times
Bram Moolenaar <Bram@vim.org>
parents: 25842
diff changeset
168 endfunc
79a5c8238a5d patch 8.2.3492: crash when pasting too many times
Bram Moolenaar <Bram@vim.org>
parents: 25842
diff changeset
169
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
170 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
171 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
172 " 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
173 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
174 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
175 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
176 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
177 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
178
14a55d1520f2 patch 8.2.3601: check for overflow in put count does not work well
Bram Moolenaar <Bram@vim.org>
parents: 26096
diff changeset
179 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
180 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
181 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
182 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
183
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 new
26260
164db42130ec patch 8.2.3661: test for put with large count fails
Bram Moolenaar <Bram@vim.org>
parents: 26137
diff changeset
185 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
186 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
187 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
188 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
189 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
190
26096
e353ace59e62 patch 8.2.3581: reading character past end of line
Bram Moolenaar <Bram@vim.org>
parents: 26087
diff changeset
191 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
192 new
e353ace59e62 patch 8.2.3581: reading character past end of line
Bram Moolenaar <Bram@vim.org>
parents: 26087
diff changeset
193 let @" = 'text'
e353ace59e62 patch 8.2.3581: reading character past end of line
Bram Moolenaar <Bram@vim.org>
parents: 26087
diff changeset
194 silent! normal 0o00
e353ace59e62 patch 8.2.3581: reading character past end of line
Bram Moolenaar <Bram@vim.org>
parents: 26087
diff changeset
195 0put
e353ace59e62 patch 8.2.3581: reading character past end of line
Bram Moolenaar <Bram@vim.org>
parents: 26087
diff changeset
196 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
197 bwipe!
e353ace59e62 patch 8.2.3581: reading character past end of line
Bram Moolenaar <Bram@vim.org>
parents: 26087
diff changeset
198 endfunc
e353ace59e62 patch 8.2.3581: reading character past end of line
Bram Moolenaar <Bram@vim.org>
parents: 26087
diff changeset
199
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
200 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
201 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
202 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
203 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
204 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
205 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
206
b79f122c6bd8 patch 8.2.3677: after a put the '] mark is on the last byte
Bram Moolenaar <Bram@vim.org>
parents: 26260
diff changeset
207 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
208 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
209 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
210 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
211 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
212
25917
79a5c8238a5d patch 8.2.3492: crash when pasting too many times
Bram Moolenaar <Bram@vim.org>
parents: 25842
diff changeset
213
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
214 " vim: shiftwidth=2 sts=2 expandtab