annotate src/testdir/test_paste.vim @ 30549:190885deceac

Added tag v9.0.0609 for changeset 84ea6d876d43b9e1e26fa2d0ecf040cf33ea2454
author Bram Moolenaar <Bram@vim.org>
date Tue, 27 Sep 2022 19:00:05 +0200
parents da77eb586899
children 457ea0570b6f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13425
bb789ed5113a patch 8.0.1587: inserting from the clipboard doesn't work literally
Christian Brabandt <cb@256bit.org>
parents: 10827
diff changeset
1 " Tests for bracketed paste and other forms of pasting.
10682
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
16074
fa133cd14f87 patch 8.1.1042: the paste test doesn't work properly in the Windows console
Bram Moolenaar <Bram@vim.org>
parents: 13460
diff changeset
3 " Bracketed paste only works with "xterm". Not in GUI or Windows console.
17657
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
4 source check.vim
28627
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
5 source term_util.vim
17657
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
6 CheckNotMSWindows
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
7 CheckNotGui
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
8
10682
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 set term=xterm
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10
13460
aa6ecb272236 patch 8.0.1604: paste test may fail if $DISPLAY is not set
Christian Brabandt <cb@256bit.org>
parents: 13425
diff changeset
11 source shared.vim
aa6ecb272236 patch 8.0.1604: paste test may fail if $DISPLAY is not set
Christian Brabandt <cb@256bit.org>
parents: 13425
diff changeset
12
10682
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 func Test_paste_normal_mode()
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 new
10813
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
15 " In first column text is inserted
10682
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 call setline(1, ['a', 'b', 'c'])
10813
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
17 call cursor(2, 1)
10682
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 call feedkeys("\<Esc>[200~foo\<CR>bar\<Esc>[201~", 'xt')
10813
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
19 call assert_equal('foo', getline(2))
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
20 call assert_equal('barb', getline(3))
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
21 call assert_equal('c', getline(4))
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
22
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
23 " When repeating text is appended
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
24 normal .
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
25 call assert_equal('barfoo', getline(3))
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
26 call assert_equal('barb', getline(4))
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
27 call assert_equal('c', getline(5))
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
28 bwipe!
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
29
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
30 " In second column text is appended
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
31 call setline(1, ['a', 'bbb', 'c'])
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
32 call cursor(2, 2)
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
33 call feedkeys("\<Esc>[200~foo\<CR>bar\<Esc>[201~", 'xt')
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
34 call assert_equal('bbfoo', getline(2))
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
35 call assert_equal('barb', getline(3))
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
36 call assert_equal('c', getline(4))
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
37
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
38 " In last column text is appended
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
39 call setline(1, ['a', 'bbb', 'c'])
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
40 call cursor(2, 3)
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
41 call feedkeys("\<Esc>[200~foo\<CR>bar\<Esc>[201~", 'xt')
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
42 call assert_equal('bbbfoo', getline(2))
10682
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 call assert_equal('bar', getline(3))
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 call assert_equal('c', getline(4))
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 endfunc
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 func Test_paste_insert_mode()
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 new
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 call setline(1, ['a', 'b', 'c'])
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 2
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 call feedkeys("i\<Esc>[200~foo\<CR>bar\<Esc>[201~ done\<Esc>", 'xt')
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 call assert_equal('foo', getline(2))
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 call assert_equal('bar doneb', getline(3))
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 call assert_equal('c', getline(4))
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 normal .
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 call assert_equal('bar donfoo', getline(3))
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 call assert_equal('bar doneeb', getline(4))
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 call assert_equal('c', getline(5))
10696
689e88afdd11 patch 8.0.0238: bracketed paste does not disable autoindent
Christian Brabandt <cb@256bit.org>
parents: 10686
diff changeset
60
689e88afdd11 patch 8.0.0238: bracketed paste does not disable autoindent
Christian Brabandt <cb@256bit.org>
parents: 10686
diff changeset
61 set ai et tw=10
689e88afdd11 patch 8.0.0238: bracketed paste does not disable autoindent
Christian Brabandt <cb@256bit.org>
parents: 10686
diff changeset
62 call setline(1, ['a', ' b', 'c'])
689e88afdd11 patch 8.0.0238: bracketed paste does not disable autoindent
Christian Brabandt <cb@256bit.org>
parents: 10686
diff changeset
63 2
689e88afdd11 patch 8.0.0238: bracketed paste does not disable autoindent
Christian Brabandt <cb@256bit.org>
parents: 10686
diff changeset
64 call feedkeys("A\<Esc>[200~foo\<CR> bar bar bar\<Esc>[201~\<Esc>", 'xt')
689e88afdd11 patch 8.0.0238: bracketed paste does not disable autoindent
Christian Brabandt <cb@256bit.org>
parents: 10686
diff changeset
65 call assert_equal(' bfoo', getline(2))
689e88afdd11 patch 8.0.0238: bracketed paste does not disable autoindent
Christian Brabandt <cb@256bit.org>
parents: 10686
diff changeset
66 call assert_equal(' bar bar bar', getline(3))
689e88afdd11 patch 8.0.0238: bracketed paste does not disable autoindent
Christian Brabandt <cb@256bit.org>
parents: 10686
diff changeset
67 call assert_equal('c', getline(4))
689e88afdd11 patch 8.0.0238: bracketed paste does not disable autoindent
Christian Brabandt <cb@256bit.org>
parents: 10686
diff changeset
68
689e88afdd11 patch 8.0.0238: bracketed paste does not disable autoindent
Christian Brabandt <cb@256bit.org>
parents: 10686
diff changeset
69 set ai& et& tw=0
10682
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 bwipe!
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 endfunc
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72
13425
bb789ed5113a patch 8.0.1587: inserting from the clipboard doesn't work literally
Christian Brabandt <cb@256bit.org>
parents: 10827
diff changeset
73 func Test_paste_clipboard()
17686
853afcc375b2 patch 8.1.1840: Testing: WorkingClipboard() is not accurate
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
74 CheckFeature clipboard_working
853afcc375b2 patch 8.1.1840: Testing: WorkingClipboard() is not accurate
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
75
13425
bb789ed5113a patch 8.0.1587: inserting from the clipboard doesn't work literally
Christian Brabandt <cb@256bit.org>
parents: 10827
diff changeset
76 let @+ = "nasty\<Esc>:!ls\<CR>command"
bb789ed5113a patch 8.0.1587: inserting from the clipboard doesn't work literally
Christian Brabandt <cb@256bit.org>
parents: 10827
diff changeset
77 new
bb789ed5113a patch 8.0.1587: inserting from the clipboard doesn't work literally
Christian Brabandt <cb@256bit.org>
parents: 10827
diff changeset
78 exe "normal i\<C-R>+\<Esc>"
bb789ed5113a patch 8.0.1587: inserting from the clipboard doesn't work literally
Christian Brabandt <cb@256bit.org>
parents: 10827
diff changeset
79 call assert_equal("nasty\<Esc>:!ls\<CR>command", getline(1))
bb789ed5113a patch 8.0.1587: inserting from the clipboard doesn't work literally
Christian Brabandt <cb@256bit.org>
parents: 10827
diff changeset
80 bwipe!
bb789ed5113a patch 8.0.1587: inserting from the clipboard doesn't work literally
Christian Brabandt <cb@256bit.org>
parents: 10827
diff changeset
81 endfunc
bb789ed5113a patch 8.0.1587: inserting from the clipboard doesn't work literally
Christian Brabandt <cb@256bit.org>
parents: 10827
diff changeset
82
20941
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 17686
diff changeset
83 " bracketed paste in command line
10682
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 func Test_paste_cmdline()
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 call feedkeys(":a\<Esc>[200~foo\<CR>bar\<Esc>[201~b\<Home>\"\<CR>", 'xt')
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 call assert_equal("\"afoo\<CR>barb", getreg(':'))
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 endfunc
10827
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
88
20941
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 17686
diff changeset
89 " bracketed paste in Ex-mode
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 17686
diff changeset
90 func Test_paste_ex_mode()
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 17686
diff changeset
91 unlet! foo
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 17686
diff changeset
92 call feedkeys("Qlet foo=\"\<Esc>[200~foo\<CR>bar\<Esc>[201~\"\<CR>vi\<CR>", 'xt')
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 17686
diff changeset
93 call assert_equal("foo\rbar", foo)
27380
7c07681f8a05 patch 8.2.4218: illegal memory access with bracketed paste in Ex mode
Bram Moolenaar <Bram@vim.org>
parents: 25969
diff changeset
94
7c07681f8a05 patch 8.2.4218: illegal memory access with bracketed paste in Ex mode
Bram Moolenaar <Bram@vim.org>
parents: 25969
diff changeset
95 " pasting more than 40 bytes
7c07681f8a05 patch 8.2.4218: illegal memory access with bracketed paste in Ex mode
Bram Moolenaar <Bram@vim.org>
parents: 25969
diff changeset
96 exe "norm Q\<PasteStart>0000000000000000000000000000000000000000000000000000000000000000000000\<C-C>"
20941
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 17686
diff changeset
97 endfunc
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 17686
diff changeset
98
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 17686
diff changeset
99 func Test_paste_onechar()
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 17686
diff changeset
100 new
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 17686
diff changeset
101 let @f='abc'
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 17686
diff changeset
102 call feedkeys("i\<C-R>\<Esc>[200~foo\<CR>bar\<Esc>[201~", 'xt')
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 17686
diff changeset
103 call assert_equal("abc", getline(1))
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 17686
diff changeset
104 close!
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 17686
diff changeset
105 endfunc
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 17686
diff changeset
106
10827
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
107 func Test_paste_visual_mode()
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
108 new
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
109 call setline(1, 'here are some words')
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
110 call feedkeys("0fsve\<Esc>[200~more\<Esc>[201~", 'xt')
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
111 call assert_equal('here are more words', getline(1))
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
112 call assert_equal('some', getreg('-'))
28085
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
113 normal! u
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
114 call assert_equal('here are some words', getline(1))
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
115 exe "normal! \<C-R>"
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
116 call assert_equal('here are more words', getline(1))
10827
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
117
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
118 " include last char in the line
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
119 call feedkeys("0fwve\<Esc>[200~noises\<Esc>[201~", 'xt')
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
120 call assert_equal('here are more noises', getline(1))
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
121 call assert_equal('words', getreg('-'))
28085
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
122 normal! u
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
123 call assert_equal('here are more words', getline(1))
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
124 exe "normal! \<C-R>"
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
125 call assert_equal('here are more noises', getline(1))
10827
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
126
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
127 " exclude last char in the line
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
128 call setline(1, 'some words!')
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
129 call feedkeys("0fwve\<Esc>[200~noises\<Esc>[201~", 'xt')
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
130 call assert_equal('some noises!', getline(1))
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
131 call assert_equal('words', getreg('-'))
28085
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
132 normal! u
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
133 call assert_equal('some words!', getline(1))
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
134 exe "normal! \<C-R>"
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
135 call assert_equal('some noises!', getline(1))
10827
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
136
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
137 " multi-line selection
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
138 call setline(1, ['some words', 'and more'])
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
139 call feedkeys("0fwvj0fd\<Esc>[200~letters\<Esc>[201~", 'xt')
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
140 call assert_equal('some letters more', getline(1))
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
141 call assert_equal("words\nand", getreg('1'))
28085
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
142 normal! u
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
143 call assert_equal(['some words', 'and more'], getline(1, 2))
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
144 exe "normal! \<C-R>"
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
145 call assert_equal('some letters more', getline(1))
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
146
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
147 " linewise non-last line, cursor at start of line
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
148 call setline(1, ['some words', 'and more'])
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
149 call feedkeys("0V\<Esc>[200~letters\<Esc>[201~", 'xt')
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
150 call assert_equal('lettersand more', getline(1))
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
151 call assert_equal("some words\n", getreg('1'))
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
152 normal! u
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
153 call assert_equal(['some words', 'and more'], getline(1, 2))
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
154 exe "normal! \<C-R>"
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
155 call assert_equal('lettersand more', getline(1))
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
156
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
157 " linewise non-last line, cursor in the middle of line
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
158 call setline(1, ['some words', 'and more'])
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
159 call feedkeys("0fwV\<Esc>[200~letters\<Esc>[201~", 'xt')
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
160 call assert_equal('lettersand more', getline(1))
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
161 call assert_equal("some words\n", getreg('1'))
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
162 normal! u
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
163 call assert_equal(['some words', 'and more'], getline(1, 2))
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
164 exe "normal! \<C-R>"
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
165 call assert_equal('lettersand more', getline(1))
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
166
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
167 " linewise last line
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
168 call setline(1, ['some words', 'and more'])
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
169 call feedkeys("j0V\<Esc>[200~letters\<Esc>[201~", 'xt')
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
170 call assert_equal(['some words', 'letters'], getline(1, 2))
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
171 call assert_equal("and more\n", getreg('1'))
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
172 normal! u
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
173 call assert_equal(['some words', 'and more'], getline(1, 2))
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
174 exe "normal! \<C-R>"
7976d709c963 patch 8.2.4567: bracketed paste doesn't work well in Visual linewise mode
Bram Moolenaar <Bram@vim.org>
parents: 27380
diff changeset
175 call assert_equal(['some words', 'letters'], getline(1, 2))
10827
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
176
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
177 bwipe!
e366b968bf08 patch 8.0.0303: bracketed paste does not work in Visual mode
Christian Brabandt <cb@256bit.org>
parents: 10813
diff changeset
178 endfunc
16608
0422b14bce58 patch 8.1.1307: cannot reconnect to the X server after it restarted
Bram Moolenaar <Bram@vim.org>
parents: 16074
diff changeset
179
0422b14bce58 patch 8.1.1307: cannot reconnect to the X server after it restarted
Bram Moolenaar <Bram@vim.org>
parents: 16074
diff changeset
180 func CheckCopyPaste()
0422b14bce58 patch 8.1.1307: cannot reconnect to the X server after it restarted
Bram Moolenaar <Bram@vim.org>
parents: 16074
diff changeset
181 call setline(1, ['copy this', ''])
0422b14bce58 patch 8.1.1307: cannot reconnect to the X server after it restarted
Bram Moolenaar <Bram@vim.org>
parents: 16074
diff changeset
182 normal 1G0"*y$
0422b14bce58 patch 8.1.1307: cannot reconnect to the X server after it restarted
Bram Moolenaar <Bram@vim.org>
parents: 16074
diff changeset
183 normal j"*p
0422b14bce58 patch 8.1.1307: cannot reconnect to the X server after it restarted
Bram Moolenaar <Bram@vim.org>
parents: 16074
diff changeset
184 call assert_equal('copy this', getline(2))
0422b14bce58 patch 8.1.1307: cannot reconnect to the X server after it restarted
Bram Moolenaar <Bram@vim.org>
parents: 16074
diff changeset
185 endfunc
0422b14bce58 patch 8.1.1307: cannot reconnect to the X server after it restarted
Bram Moolenaar <Bram@vim.org>
parents: 16074
diff changeset
186
0422b14bce58 patch 8.1.1307: cannot reconnect to the X server after it restarted
Bram Moolenaar <Bram@vim.org>
parents: 16074
diff changeset
187 func Test_xrestore()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
188 CheckFeature xterm_clipboard
25969
a5a772dace5b patch 8.2.3518: Test_xrestore sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 24914
diff changeset
189 let g:test_is_flaky = 1
a5a772dace5b patch 8.2.3518: Test_xrestore sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 24914
diff changeset
190
16608
0422b14bce58 patch 8.1.1307: cannot reconnect to the X server after it restarted
Bram Moolenaar <Bram@vim.org>
parents: 16074
diff changeset
191 let display = $DISPLAY
0422b14bce58 patch 8.1.1307: cannot reconnect to the X server after it restarted
Bram Moolenaar <Bram@vim.org>
parents: 16074
diff changeset
192 new
0422b14bce58 patch 8.1.1307: cannot reconnect to the X server after it restarted
Bram Moolenaar <Bram@vim.org>
parents: 16074
diff changeset
193 call CheckCopyPaste()
0422b14bce58 patch 8.1.1307: cannot reconnect to the X server after it restarted
Bram Moolenaar <Bram@vim.org>
parents: 16074
diff changeset
194
0422b14bce58 patch 8.1.1307: cannot reconnect to the X server after it restarted
Bram Moolenaar <Bram@vim.org>
parents: 16074
diff changeset
195 xrestore
0422b14bce58 patch 8.1.1307: cannot reconnect to the X server after it restarted
Bram Moolenaar <Bram@vim.org>
parents: 16074
diff changeset
196 call CheckCopyPaste()
0422b14bce58 patch 8.1.1307: cannot reconnect to the X server after it restarted
Bram Moolenaar <Bram@vim.org>
parents: 16074
diff changeset
197
0422b14bce58 patch 8.1.1307: cannot reconnect to the X server after it restarted
Bram Moolenaar <Bram@vim.org>
parents: 16074
diff changeset
198 exe "xrestore " .. display
0422b14bce58 patch 8.1.1307: cannot reconnect to the X server after it restarted
Bram Moolenaar <Bram@vim.org>
parents: 16074
diff changeset
199 call CheckCopyPaste()
0422b14bce58 patch 8.1.1307: cannot reconnect to the X server after it restarted
Bram Moolenaar <Bram@vim.org>
parents: 16074
diff changeset
200
0422b14bce58 patch 8.1.1307: cannot reconnect to the X server after it restarted
Bram Moolenaar <Bram@vim.org>
parents: 16074
diff changeset
201 bwipe!
0422b14bce58 patch 8.1.1307: cannot reconnect to the X server after it restarted
Bram Moolenaar <Bram@vim.org>
parents: 16074
diff changeset
202 endfunc
20941
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 17686
diff changeset
203
24134
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
204 " Test for 'pastetoggle'
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
205 func Test_pastetoggle()
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
206 new
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
207 set pastetoggle=<F4>
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
208 set nopaste
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
209 call feedkeys("iHello\<F4>", 'xt')
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
210 call assert_true(&paste)
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
211 call feedkeys("i\<F4>", 'xt')
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
212 call assert_false(&paste)
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
213 call assert_equal('Hello', getline(1))
24914
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
214 " command-line completion for 'pastetoggle' value
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
215 call feedkeys(":set pastetoggle=\<Tab>\<C-B>\"\<CR>", 'xt')
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
216 call assert_equal('"set pastetoggle=<F4>', @:)
24134
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
217 set pastetoggle&
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
218 bwipe!
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
219 endfunc
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
220
28627
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
221 func Test_pastetoggle_timeout_no_typed_after_mapped()
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
222 CheckRunVimInTerminal
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
223
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
224 let lines =<< trim END
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
225 set pastetoggle=abc
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
226 set ttimeoutlen=10000
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
227 imap d a
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
228 END
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
229 call writefile(lines, 'Xpastetoggle_no_typed_after_mapped.vim')
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
230 let buf = RunVimInTerminal('-S Xpastetoggle_no_typed_after_mapped.vim', #{rows: 8})
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
231 call TermWait(buf)
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
232 call term_sendkeys(buf, ":call feedkeys('id', 't')\<CR>")
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
233 call term_wait(buf, 200)
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
234 call term_sendkeys(buf, 'bc')
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
235 " 'ttimeoutlen' should NOT apply
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
236 call WaitForAssert({-> assert_match('^-- INSERT --', term_getline(buf, 8))})
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
237
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
238 call StopVimInTerminal(buf)
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
239 call delete('Xpastetoggle_no_typed_after_mapped.vim')
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
240 endfunc
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
241
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
242 func Test_pastetoggle_timeout_typed_after_mapped()
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
243 CheckRunVimInTerminal
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
244
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
245 let lines =<< trim END
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
246 set pastetoggle=abc
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
247 set ttimeoutlen=10000
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
248 imap d a
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
249 END
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
250 call writefile(lines, 'Xpastetoggle_typed_after_mapped.vim')
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
251 let buf = RunVimInTerminal('-S Xpastetoggle_typed_after_mapped.vim', #{rows: 8})
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
252 call TermWait(buf)
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
253 call term_sendkeys(buf, ":call feedkeys('idb', 't')\<CR>")
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
254 call term_wait(buf, 200)
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
255 call term_sendkeys(buf, 'c')
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
256 " 'ttimeoutlen' should apply
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
257 call WaitForAssert({-> assert_match('^-- INSERT (paste) --', term_getline(buf, 8))})
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
258
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
259 call StopVimInTerminal(buf)
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
260 call delete('Xpastetoggle_typed_after_mapped.vim')
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
261 endfunc
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
262
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
263 func Test_pastetoggle_timeout_typed_after_noremap()
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
264 CheckRunVimInTerminal
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
265
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
266 let lines =<< trim END
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
267 set pastetoggle=abc
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
268 set ttimeoutlen=10000
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
269 inoremap d a
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
270 END
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
271 call writefile(lines, 'Xpastetoggle_typed_after_noremap.vim')
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
272 let buf = RunVimInTerminal('-S Xpastetoggle_typed_after_noremap.vim', #{rows: 8})
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
273 call TermWait(buf)
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
274 call term_sendkeys(buf, ":call feedkeys('idb', 't')\<CR>")
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
275 call term_wait(buf, 200)
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
276 call term_sendkeys(buf, 'c')
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
277 " 'ttimeoutlen' should apply
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
278 call WaitForAssert({-> assert_match('^-- INSERT (paste) --', term_getline(buf, 8))})
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
279
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
280 call StopVimInTerminal(buf)
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
281 call delete('Xpastetoggle_typed_after_noremap.vim')
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
282 endfunc
da77eb586899 patch 8.2.4837: modifiers not simplified when timed out
Bram Moolenaar <Bram@vim.org>
parents: 28085
diff changeset
283
24914
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
284 " Test for restoring option values when 'paste' is disabled
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
285 func Test_paste_opt_restore()
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
286 set autoindent expandtab ruler showmatch
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
287 if has('rightleft')
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
288 set revins hkmap
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
289 endif
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
290 set smarttab softtabstop=3 textwidth=27 wrapmargin=12
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
291 if has('vartabs')
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
292 set varsofttabstop=10,20
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
293 endif
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
294
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
295 " enabling 'paste' should reset the above options
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
296 set paste
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
297 call assert_false(&autoindent)
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
298 call assert_false(&expandtab)
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
299 if has('rightleft')
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
300 call assert_false(&revins)
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
301 call assert_false(&hkmap)
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
302 endif
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
303 call assert_false(&ruler)
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
304 call assert_false(&showmatch)
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
305 call assert_false(&smarttab)
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
306 call assert_equal(0, &softtabstop)
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
307 call assert_equal(0, &textwidth)
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
308 call assert_equal(0, &wrapmargin)
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
309 if has('vartabs')
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
310 call assert_equal('', &varsofttabstop)
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
311 endif
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
312
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
313 " disabling 'paste' should restore the option values
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
314 set nopaste
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
315 call assert_true(&autoindent)
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
316 call assert_true(&expandtab)
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
317 if has('rightleft')
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
318 call assert_true(&revins)
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
319 call assert_true(&hkmap)
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
320 endif
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
321 call assert_true(&ruler)
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
322 call assert_true(&showmatch)
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
323 call assert_true(&smarttab)
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
324 call assert_equal(3, &softtabstop)
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
325 call assert_equal(27, &textwidth)
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
326 call assert_equal(12, &wrapmargin)
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
327 if has('vartabs')
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
328 call assert_equal('10,20', &varsofttabstop)
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
329 endif
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
330
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
331 set autoindent& expandtab& ruler& showmatch&
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
332 if has('rightleft')
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
333 set revins& hkmap&
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
334 endif
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
335 set smarttab& softtabstop& textwidth& wrapmargin&
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
336 if has('vartabs')
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
337 set varsofttabstop&
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
338 endif
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
339 endfunc
1186160ecf57 patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
340
20941
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 17686
diff changeset
341 " vim: shiftwidth=2 sts=2 expandtab