annotate src/testdir/test_paste.vim @ 10813:09eb5fd275e0 v8.0.0296

patch 8.0.0296: bracketed paste can only append, not insert commit https://github.com/vim/vim/commit/fd8983b09c64d9bfa8a4bdc16d72c55fbb22b4dc Author: Bram Moolenaar <Bram@vim.org> Date: Thu Feb 2 22:21:29 2017 +0100 patch 8.0.0296: bracketed paste can only append, not insert Problem: Bracketed paste can only append, not insert. Solution: When the cursor is in the first column insert the text.
author Christian Brabandt <cb@256bit.org>
date Thu, 02 Feb 2017 22:30:04 +0100
parents 689e88afdd11
children e366b968bf08
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10682
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for bracketed paste.
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
10686
23ada4caa13b patch 8.0.0233: paste test fails in the GUI
Christian Brabandt <cb@256bit.org>
parents: 10682
diff changeset
3 " Bracketed paste only works with "xterm". Not in GUI.
23ada4caa13b patch 8.0.0233: paste test fails in the GUI
Christian Brabandt <cb@256bit.org>
parents: 10682
diff changeset
4 if has('gui_running')
23ada4caa13b patch 8.0.0233: paste test fails in the GUI
Christian Brabandt <cb@256bit.org>
parents: 10682
diff changeset
5 finish
23ada4caa13b patch 8.0.0233: paste test fails in the GUI
Christian Brabandt <cb@256bit.org>
parents: 10682
diff changeset
6 endif
10682
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 set term=xterm
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 func Test_paste_normal_mode()
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 new
10813
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
11 " 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
12 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
13 call cursor(2, 1)
10682
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 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
15 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
16 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
17 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
18
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
19 " 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
20 normal .
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('barfoo', getline(3))
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
22 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
23 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
24 bwipe!
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
25
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
26 " 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
27 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
28 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
29 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
30 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
31 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
32 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
33
09eb5fd275e0 patch 8.0.0296: bracketed paste can only append, not insert
Christian Brabandt <cb@256bit.org>
parents: 10696
diff changeset
34 " 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
35 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
36 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
37 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
38 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
39 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
40 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
41 endfunc
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 func Test_paste_insert_mode()
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 new
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 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
46 2
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 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
48 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
49 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
50 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
51
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 normal .
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 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
54 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
55 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
56
689e88afdd11 patch 8.0.0238: bracketed paste does not disable autoindent
Christian Brabandt <cb@256bit.org>
parents: 10686
diff changeset
57 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
58 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
59 2
689e88afdd11 patch 8.0.0238: bracketed paste does not disable autoindent
Christian Brabandt <cb@256bit.org>
parents: 10686
diff changeset
60 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
61 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
62 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
63 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
64
689e88afdd11 patch 8.0.0238: bracketed paste does not disable autoindent
Christian Brabandt <cb@256bit.org>
parents: 10686
diff changeset
65 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
66 bwipe!
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 endfunc
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 func Test_paste_cmdline()
d564e73ff9ee patch 8.0.0231: bracketed paste mode is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 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
71 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
72 endfunc