annotate src/testdir/test_edit.vim @ 14985:4ebda55537a5 v8.1.0504

patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave commit https://github.com/vim/vim/commit/4dbc2627641a6b950c30c31cbf7b7e6c36da1927 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Nov 2 11:59:15 2018 +0100 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave Problem: When CTRL-C is mapped it triggers InsertLeave. Solution: Make CTRL-C behave the same way when typed or used in a mapping.
author Bram Moolenaar <Bram@vim.org>
date Fri, 02 Nov 2018 12:00:07 +0100
parents 9ffce640d0d3
children 63b02fcf1361
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test for edit functions
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2 "
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 if exists("+t_kD")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 let &t_kD="[3;*~"
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 " Needed for testing basic rightleft: Test_edit_rightleft
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 source view_util.vim
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 " Needs to come first until the bug in getchar() is
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 " fixed: https://groups.google.com/d/msg/vim_dev/fXL9yme4H4c/bOR-U6_bAQAJ
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 func! Test_edit_00b()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 call setline(1, ['abc '])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 inoreabbr <buffer> h here some more
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 call cursor(1, 4)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 " <c-l> expands the abbreviation and ends insertmode
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 call feedkeys(":set im\<cr> h\<c-l>:set noim\<cr>", 'tix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 call assert_equal(['abc here some more '], getline(1,'$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 iunabbr <buffer> h
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 func! Test_edit_01()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 " set for Travis CI?
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 " set nocp noesckeys
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 " 1) empty buffer
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 call assert_equal([''], getline(1,'$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 " 2) delete in an empty line
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 call feedkeys("i\<del>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 call assert_equal([''], getline(1,'$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 " 3) delete one character
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 call setline(1, 'a')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 call feedkeys("i\<del>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 call assert_equal([''], getline(1,'$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 " 4) delete a multibyte character
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 if has("multi_byte")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 call setline(1, "\u0401")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 call feedkeys("i\<del>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 call assert_equal([''], getline(1,'$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 " 5.1) delete linebreak with 'bs' option containing eol
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 let _bs=&bs
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 set bs=eol
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 call setline(1, ["abc def", "ghi jkl"])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 call feedkeys("A\<del>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 call assert_equal(['abc defghi jkl'], getline(1, 2))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 " 5.2) delete linebreak with backspace option w/out eol
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 set bs=
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 call setline(1, ["abc def", "ghi jkl"])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 call feedkeys("A\<del>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 call assert_equal(["abc def", "ghi jkl"], getline(1, 2))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 let &bs=_bs
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 func! Test_edit_02()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 " Change cursor position in InsertCharPre command
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 call setline(1, 'abc')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 fu! DoIt(...)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 call cursor(1, 4)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 if len(a:000)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 let v:char=a:1
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 endfu
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 au InsertCharPre <buffer> :call DoIt('y')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 call feedkeys("ix\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 call assert_equal(['abcy'], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 " Setting <Enter> in InsertCharPre
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 au! InsertCharPre <buffer> :call DoIt("\n")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 call setline(1, 'abc')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 call feedkeys("ix\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 call assert_equal(['abc', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 au! InsertCharPre
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 " Change cursor position in InsertEnter command
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 " 1) when setting v:char, keeps changed cursor position
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 au! InsertEnter <buffer> :call DoIt('y')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 call setline(1, 'abc')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 call feedkeys("ix\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 call assert_equal(['abxc'], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 " 2) when not setting v:char, restores changed cursor position
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 au! InsertEnter <buffer> :call DoIt()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 call setline(1, 'abc')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 call feedkeys("ix\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98 call assert_equal(['xabc'], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 au! InsertEnter
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 delfu DoIt
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104 func! Test_edit_03()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
105 " Change cursor after <c-o> command to end of line
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
106 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107 call setline(1, 'abc')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
108 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109 call feedkeys("i\<c-o>$y\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
110 call assert_equal(['abcy'], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112 call setline(1, 'abc')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
114 call feedkeys("i\<c-o>80|y\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115 call assert_equal(['abcy'], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
116 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117 call setline(1, 'abc')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
118 call feedkeys("Ad\<c-o>:s/$/efg/\<cr>hij", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
119 call assert_equal(['hijabcdefg'], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
120 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
122
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123 func! Test_edit_04()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124 " test for :stopinsert
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126 call setline(1, 'abc')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128 call feedkeys("i\<c-o>:stopinsert\<cr>$", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
129 call feedkeys("aX\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
130 call assert_equal(['abcX'], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
131 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
134
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
135 func! Test_edit_05()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
136 " test for folds being opened
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
137 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
138 call setline(1, ['abcX', 'abcX', 'zzzZ'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
139 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
140 set foldmethod=manual foldopen+=insert
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
141 " create fold for those two lines
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
142 norm! Vjzf
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143 call feedkeys("$ay\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
144 call assert_equal(['abcXy', 'abcX', 'zzzZ'], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
145 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
146 call setline(1, ['abcX', 'abcX', 'zzzZ'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
147 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
148 set foldmethod=manual foldopen-=insert
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
149 " create fold for those two lines
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
150 norm! Vjzf
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
151 call feedkeys("$ay\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
152 call assert_equal(['abcXy', 'abcX', 'zzzZ'], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
153 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
154 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
155 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
156
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
157 func! Test_edit_06()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
158 " Test in diff mode
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
159 if !has("diff") || !executable("diff")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
160 return
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
161 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
162 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
163 call setline(1, ['abc', 'xxx', 'yyy'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
164 vnew
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
165 call setline(1, ['abc', 'zzz', 'xxx', 'yyy'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
166 wincmd p
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
167 diffthis
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
168 wincmd p
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
169 diffthis
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
170 wincmd p
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
171 call cursor(2, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
172 norm! zt
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
173 call feedkeys("Ozzz\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
174 call assert_equal(['abc', 'zzz', 'xxx', 'yyy'], getline(1,'$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
175 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
177 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
178
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
179 func! Test_edit_07()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
180 " 1) Test with completion <c-l> when popupmenu is visible
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
181 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
182 call setline(1, 'J')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
183
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
184 func! ListMonths()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
185 call complete(col('.')-1, ['January', 'February', 'March',
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
186 \ 'April', 'May', 'June', 'July', 'August', 'September',
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
187 \ 'October', 'November', 'December'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
188 return ''
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
189 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
190 inoremap <buffer> <F5> <C-R>=ListMonths()<CR>
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
191
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
192 call feedkeys("A\<f5>\<c-p>". repeat("\<down>", 6)."\<c-l>\<down>\<c-l>\<cr>", 'tx')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
193 call assert_equal(['July'], getline(1,'$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
194 " 1) Test completion when InsertCharPre kicks in
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
195 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
196 call setline(1, 'J')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
197 fu! DoIt()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
198 if v:char=='u'
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
199 let v:char='an'
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
200 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
201 endfu
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
202 au InsertCharPre <buffer> :call DoIt()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
203 call feedkeys("A\<f5>\<c-p>u\<cr>\<c-l>\<cr>", 'tx')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
204 call assert_equal(["Jan\<c-l>",''], getline(1,'$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
205 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
206 call setline(1, 'J')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
207 call feedkeys("A\<f5>\<c-p>u\<down>\<c-l>\<cr>", 'tx')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
208 call assert_equal(["January"], getline(1,'$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
209
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
210 delfu ListMonths
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
211 delfu DoIt
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
212 iunmap <buffer> <f5>
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
213 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
214 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
215
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
216 func! Test_edit_08()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
217 " reset insertmode from i_ctrl-r_=
12696
6daad7ef16be patch 8.0.1226: edit and popup tests failing
Christian Brabandt <cb@256bit.org>
parents: 12654
diff changeset
218 let g:bufnr = bufnr('%')
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
219 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
220 call setline(1, ['abc'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
221 call cursor(1, 4)
12696
6daad7ef16be patch 8.0.1226: edit and popup tests failing
Christian Brabandt <cb@256bit.org>
parents: 12654
diff changeset
222 call feedkeys(":set im\<cr>ZZZ\<c-r>=setbufvar(g:bufnr,'&im', 0)\<cr>",'tnix')
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
223 call assert_equal(['abZZZc'], getline(1,'$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
224 call assert_equal([0, 1, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
225 call assert_false(0, '&im')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
226 bw!
12696
6daad7ef16be patch 8.0.1226: edit and popup tests failing
Christian Brabandt <cb@256bit.org>
parents: 12654
diff changeset
227 unlet g:bufnr
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
228 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
229
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
230 func! Test_edit_09()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
231 " test i_CTRL-\ combinations
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
232 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
233 call setline(1, ['abc', 'def', 'ghi'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
234 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
235 " 1) CTRL-\ CTLR-N
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
236 call feedkeys(":set im\<cr>\<c-\>\<c-n>ccABC\<c-l>", 'txin')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
237 call assert_equal(['ABC', 'def', 'ghi'], getline(1,'$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
238 call setline(1, ['ABC', 'def', 'ghi'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
239 " 2) CTRL-\ CTLR-G
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
240 call feedkeys("j0\<c-\>\<c-g>ZZZ\<cr>\<c-l>", 'txin')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
241 call assert_equal(['ABC', 'ZZZ', 'def', 'ghi'], getline(1,'$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
242 call feedkeys("I\<c-\>\<c-g>YYY\<c-l>", 'txin')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
243 call assert_equal(['ABC', 'ZZZ', 'YYYdef', 'ghi'], getline(1,'$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
244 set noinsertmode
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
245 " 3) CTRL-\ CTRL-O
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
246 call setline(1, ['ABC', 'ZZZ', 'def', 'ghi'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
247 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
248 call feedkeys("A\<c-o>ix", 'txin')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
249 call assert_equal(['ABxC', 'ZZZ', 'def', 'ghi'], getline(1,'$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
250 call feedkeys("A\<c-\>\<c-o>ix", 'txin')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
251 call assert_equal(['ABxCx', 'ZZZ', 'def', 'ghi'], getline(1,'$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
252 " 4) CTRL-\ a (should be inserted literally, not special after <c-\>
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
253 call setline(1, ['ABC', 'ZZZ', 'def', 'ghi'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
254 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
255 call feedkeys("A\<c-\>a", 'txin')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
256 call assert_equal(["ABC\<c-\>a", 'ZZZ', 'def', 'ghi'], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
257 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
258 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
259
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
260 func! Test_edit_10()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
261 " Test for starting selectmode
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
262 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
263 set selectmode=key keymodel=startsel
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
264 call setline(1, ['abc', 'def', 'ghi'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
265 call cursor(1, 4)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
266 call feedkeys("A\<s-home>start\<esc>", 'txin')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
267 call assert_equal(['startdef', 'ghi'], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
268 set selectmode= keymodel=
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
269 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
270 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
271
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
272 func! Test_edit_11()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
273 " Test that indenting kicks in
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
274 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
275 set cindent
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
276 call setline(1, ['{', '', ''])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
277 call cursor(2, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
278 call feedkeys("i\<c-f>int c;\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
279 call cursor(3, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
280 call feedkeys("i/* comment */", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
281 call assert_equal(['{', "\<tab>int c;", "/* comment */"], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
282 " added changed cindentkeys slightly
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
283 set cindent cinkeys+=*/
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
284 call setline(1, ['{', '', ''])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
285 call cursor(2, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
286 call feedkeys("i\<c-f>int c;\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
287 call cursor(3, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
288 call feedkeys("i/* comment */", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
289 call assert_equal(['{', "\<tab>int c;", "\<tab>/* comment */"], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
290 set cindent cinkeys+==end
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
291 call feedkeys("oend\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
292 call assert_equal(['{', "\<tab>int c;", "\<tab>/* comment */", "\tend", ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
293 set cinkeys-==end
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
294 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
295 " Use indentexpr instead of cindenting
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
296 func! Do_Indent()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
297 if v:lnum == 3
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
298 return 3*shiftwidth()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
299 else
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
300 return 2*shiftwidth()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
301 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
302 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
303 setl indentexpr=Do_Indent() indentkeys+=*/
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
304 call setline(1, ['{', '', ''])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
305 call cursor(2, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
306 call feedkeys("i\<c-f>int c;\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
307 call cursor(3, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
308 call feedkeys("i/* comment */", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
309 call assert_equal(['{', "\<tab>\<tab>int c;", "\<tab>\<tab>\<tab>/* comment */"], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
310 set cinkeys&vim indentkeys&vim
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
311 set nocindent indentexpr=
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
312 delfu Do_Indent
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
313 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
314 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
315
12551
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
316 func! Test_edit_11_indentexpr()
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
317 " Test that indenting kicks in
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
318 new
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
319 " Use indentexpr instead of cindenting
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
320 func! Do_Indent()
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
321 let pline=prevnonblank(v:lnum)
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
322 if empty(getline(v:lnum))
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
323 if getline(pline) =~ 'if\|then'
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
324 return shiftwidth()
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
325 else
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
326 return 0
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
327 endif
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
328 else
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
329 return 0
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
330 endif
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
331 endfunc
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
332 setl indentexpr=Do_Indent() indentkeys+=0=then,0=fi
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
333 call setline(1, ['if [ $this ]'])
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
334 call cursor(1, 1)
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
335 call feedkeys("othen\<cr>that\<cr>fi", 'tnix')
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
336 call assert_equal(['if [ $this ]', "then", "\<tab>that", "fi"], getline(1, '$'))
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
337 set cinkeys&vim indentkeys&vim
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
338 set nocindent indentexpr=
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
339 delfu Do_Indent
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
340 bw!
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
341 endfunc
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
342
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
343 func! Test_edit_12()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
344 " Test changing indent in replace mode
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
345 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
346 call setline(1, ["\tabc", "\tdef"])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
347 call cursor(2, 4)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
348 call feedkeys("R^\<c-d>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
349 call assert_equal(["\tabc", "def"], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
350 call assert_equal([0, 2, 2, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
351 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
352 call setline(1, ["\tabc", "\t\tdef"])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
353 call cursor(2, 2)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
354 call feedkeys("R^\<c-d>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
355 call assert_equal(["\tabc", "def"], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
356 call assert_equal([0, 2, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
357 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
358 call setline(1, ["\tabc", "\t\tdef"])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
359 call cursor(2, 2)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
360 call feedkeys("R\<c-t>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
361 call assert_equal(["\tabc", "\t\t\tdef"], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
362 call assert_equal([0, 2, 2, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
363 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
364 10vnew
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
365 call setline(1, ["\tabc", "\t\tdef"])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
366 call cursor(2, 2)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
367 call feedkeys("R\<c-t>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
368 call assert_equal(["\tabc", "\t\t\tdef"], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
369 call assert_equal([0, 2, 2, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
370 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
371 set sw=4
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
372 call setline(1, ["\tabc", "\t\tdef"])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
373 call cursor(2, 2)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
374 call feedkeys("R\<c-t>\<c-t>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
375 call assert_equal(["\tabc", "\t\t\tdef"], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
376 call assert_equal([0, 2, 2, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
377 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
378 call setline(1, ["\tabc", "\t\tdef"])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
379 call cursor(2, 2)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
380 call feedkeys("R\<c-t>\<c-t>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
381 call assert_equal(["\tabc", "\t\t\tdef"], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
382 call assert_equal([0, 2, 2, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
383 set et
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
384 set sw& et&
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
385 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
386 call setline(1, ["\t/*"])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
387 set formatoptions=croql
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
388 call cursor(1, 3)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
389 call feedkeys("A\<cr>\<cr>/", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
390 call assert_equal(["\t/*", " *", " */"], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
391 set formatoptions&
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
392 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
393 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
394
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
395 func! Test_edit_13()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
396 " Test smartindenting
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
397 if exists("+smartindent")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
398 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
399 set smartindent autoindent
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
400 call setline(1, ["\tabc"])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
401 call feedkeys("A {\<cr>more\<cr>}\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
402 call assert_equal(["\tabc {", "\t\tmore", "\t}"], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
403 set smartindent& autoindent&
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
404 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
405 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
406 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
407
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
408 func! Test_edit_CR()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
409 " Test for <CR> in insert mode
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
410 " basically only in quickfix mode ist tested, the rest
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
411 " has been taken care of by other tests
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
412 if !has("quickfix")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
413 return
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
414 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
415 botright new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
416 call writefile(range(1, 10), 'Xqflist.txt')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
417 call setqflist([{'filename': 'Xqflist.txt', 'lnum': 2}])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
418 copen
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
419 set modifiable
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
420 call feedkeys("A\<cr>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
421 call assert_equal('Xqflist.txt', bufname(''))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
422 call assert_equal(2, line('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
423 cclose
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
424 botright new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
425 call setloclist(0, [{'filename': 'Xqflist.txt', 'lnum': 10}])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
426 lopen
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
427 set modifiable
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
428 call feedkeys("A\<cr>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
429 call assert_equal('Xqflist.txt', bufname(''))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
430 call assert_equal(10, line('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
431 call feedkeys("A\<Enter>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
432 call feedkeys("A\<kEnter>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
433 call feedkeys("A\n", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
434 call feedkeys("A\r", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
435 call assert_equal(map(range(1, 10), 'string(v:val)') + ['', '', '', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
436 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
437 lclose
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
438 call delete('Xqflist.txt')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
439 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
440
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
441 func! Test_edit_CTRL_()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
442 " disabled for Windows builds, why?
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
443 if !has("multi_byte") || !has("rightleft") || has("win32")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
444 return
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
445 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
446 let _encoding=&encoding
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
447 set encoding=utf-8
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
448 " Test for CTRL-_
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
449 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
450 call setline(1, ['abc'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
451 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
452 call feedkeys("i\<c-_>xyz\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
453 call assert_equal(["\<C-_>xyzabc"], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
454 call assert_false(&revins)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
455 set ari
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
456 call setline(1, ['abc'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
457 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
458 call feedkeys("i\<c-_>xyz\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
459 call assert_equal(["æèñabc"], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
460 call assert_true(&revins)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
461 call setline(1, ['abc'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
462 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
463 call feedkeys("i\<c-_>xyz\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
464 call assert_equal(["xyzabc"], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
465 call assert_false(&revins)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
466 set noari
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
467 let &encoding=_encoding
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
468 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
469 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
470
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
471 " needs to come first, to have the @. register empty
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
472 func! Test_edit_00a_CTRL_A()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
473 " Test pressing CTRL-A
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
474 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
475 call setline(1, repeat([''], 5))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
476 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
477 try
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
478 call feedkeys("A\<NUL>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
479 catch /^Vim\%((\a\+)\)\=:E29/
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
480 call assert_true(1, 'E29 error caught')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
481 endtry
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
482 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
483 call feedkeys("Afoobar \<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
484 call cursor(2, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
485 call feedkeys("A\<c-a>more\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
486 call cursor(3, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
487 call feedkeys("A\<NUL>and more\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
488 call assert_equal(['foobar ', 'foobar more', 'foobar morend more', '', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
489 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
490 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
491
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
492 func! Test_edit_CTRL_EY()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
493 " Ctrl-E/ Ctrl-Y in insert mode completion to scroll
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
494 10new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
495 call setline(1, range(1, 100))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
496 call cursor(30, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
497 norm! z.
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
498 call feedkeys("A\<c-x>\<c-e>\<c-e>\<c-e>\<c-e>\<c-e>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
499 call assert_equal(30, winsaveview()['topline'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
500 call assert_equal([0, 30, 2, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
501 call feedkeys("A\<c-x>\<c-e>\<c-e>\<c-e>\<c-e>\<c-e>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
502 call feedkeys("A\<c-x>".repeat("\<c-y>", 10), 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
503 call assert_equal(21, winsaveview()['topline'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
504 call assert_equal([0, 30, 2, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
505 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
506 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
507
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
508 func! Test_edit_CTRL_G()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
509 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
510 call setline(1, ['foobar', 'foobar', 'foobar'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
511 call cursor(2, 4)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
512 call feedkeys("ioooooooo\<c-g>k\<c-r>.\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
513 call assert_equal(['foooooooooobar', 'foooooooooobar', 'foobar'], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
514 call assert_equal([0, 1, 11, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
515 call feedkeys("i\<c-g>k\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
516 call assert_equal([0, 1, 10, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
517 call cursor(2, 4)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
518 call feedkeys("i\<c-g>jzzzz\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
519 call assert_equal(['foooooooooobar', 'foooooooooobar', 'foozzzzbar'], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
520 call assert_equal([0, 3, 7, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
521 call feedkeys("i\<c-g>j\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
522 call assert_equal([0, 3, 6, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
523 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
524 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
525
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
526 func! Test_edit_CTRL_I()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
527 " Tab in completion mode
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
528 let path=expand("%:p:h")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
529 new
14039
acb2dc112b06 patch 8.1.0037: cannot easily append lines to another buffer
Christian Brabandt <cb@256bit.org>
parents: 14033
diff changeset
530 call setline(1, [path. "/", ''])
11171
7fc6afa998be patch 8.0.0472: when a test fails another test may also fail
Christian Brabandt <cb@256bit.org>
parents: 11105
diff changeset
531 call feedkeys("Arunt\<c-x>\<c-f>\<tab>\<cr>\<esc>", 'tnix')
7fc6afa998be patch 8.0.0472: when a test fails another test may also fail
Christian Brabandt <cb@256bit.org>
parents: 11105
diff changeset
532 call assert_match('runtest\.vim', getline(1))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
533 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
534 call writefile(['one', 'two', 'three'], 'Xinclude.txt')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
535 let include='#include Xinclude.txt'
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
536 call setline(1, [include, ''])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
537 call cursor(2, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
538 call feedkeys("A\<c-x>\<tab>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
539 call assert_equal([include, 'one', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
540 call feedkeys("2ggC\<c-x>\<tab>\<down>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
541 call assert_equal([include, 'two', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
542 call feedkeys("2ggC\<c-x>\<tab>\<down>\<down>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
543 call assert_equal([include, 'three', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
544 call feedkeys("2ggC\<c-x>\<tab>\<down>\<down>\<down>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
545 call assert_equal([include, '', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
546 call delete("Xinclude.txt")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
547 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
548 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
549
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
550 func! Test_edit_CTRL_K()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
551 " Test pressing CTRL-K (basically only dictionary completion and digraphs
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
552 " the rest is already covered
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
553 call writefile(['A', 'AA', 'AAA', 'AAAA'], 'Xdictionary.txt')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
554 set dictionary=Xdictionary.txt
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
555 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
556 call setline(1, 'A')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
557 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
558 call feedkeys("A\<c-x>\<c-k>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
559 call assert_equal(['AA', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
560 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
561 call setline(1, 'A')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
562 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
563 call feedkeys("A\<c-x>\<c-k>\<down>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
564 call assert_equal(['AAA'], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
565 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
566 call setline(1, 'A')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
567 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
568 call feedkeys("A\<c-x>\<c-k>\<down>\<down>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
569 call assert_equal(['AAAA'], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
570 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
571 call setline(1, 'A')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
572 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
573 call feedkeys("A\<c-x>\<c-k>\<down>\<down>\<down>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
574 call assert_equal(['A'], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
575 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
576 call setline(1, 'A')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
577 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
578 call feedkeys("A\<c-x>\<c-k>\<down>\<down>\<down>\<down>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
579 call assert_equal(['AA'], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
580
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
581 " press an unexecpted key after dictionary completion
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
582 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
583 call setline(1, 'A')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
584 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
585 call feedkeys("A\<c-x>\<c-k>\<c-]>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
586 call assert_equal(['AA', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
587 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
588 call setline(1, 'A')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
589 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
590 call feedkeys("A\<c-x>\<c-k>\<c-s>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
591 call assert_equal(["AA\<c-s>", ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
592 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
593 call setline(1, 'A')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
594 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
595 call feedkeys("A\<c-x>\<c-k>\<c-f>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
596 call assert_equal(["AA\<c-f>", ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
597
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
598 set dictionary=
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
599 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
600 call setline(1, 'A')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
601 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
602 let v:testing = 1
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
603 try
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
604 call feedkeys("A\<c-x>\<c-k>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
605 catch
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
606 " error sleeps 2 seconds, when v:testing is not set
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
607 let v:testing = 0
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
608 endtry
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
609 call delete('Xdictionary.txt')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
610
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
611 if has("multi_byte")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
612 call test_override("char_avail", 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
613 set showcmd
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
614 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
615 call feedkeys("A\<c-k>a:\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
616 call assert_equal(['ä'], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
617 call test_override("char_avail", 0)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
618 set noshowcmd
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
619 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
620 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
621 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
622
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
623 func! Test_edit_CTRL_L()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
624 " Test Ctrl-X Ctrl-L (line completion)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
625 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
626 set complete=.
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
627 call setline(1, ['one', 'two', 'three', '', '', '', ''])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
628 call cursor(4, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
629 call feedkeys("A\<c-x>\<c-l>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
630 call assert_equal(['one', 'two', 'three', 'three', '', '', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
631 call feedkeys("cct\<c-x>\<c-l>\<c-n>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
632 call assert_equal(['one', 'two', 'three', 't', '', '', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
633 call feedkeys("cct\<c-x>\<c-l>\<c-n>\<c-n>\<esc>", 'tnix')
13215
ae5f855a64be patch 8.0.1482: using feedkeys() does not work to test completion
Christian Brabandt <cb@256bit.org>
parents: 12696
diff changeset
634 call assert_equal(['one', 'two', 'three', 'two', '', '', ''], getline(1, '$'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
635 call feedkeys("cct\<c-x>\<c-l>\<c-n>\<c-n>\<c-n>\<esc>", 'tnix')
13215
ae5f855a64be patch 8.0.1482: using feedkeys() does not work to test completion
Christian Brabandt <cb@256bit.org>
parents: 12696
diff changeset
636 call assert_equal(['one', 'two', 'three', 'three', '', '', ''], getline(1, '$'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
637 call feedkeys("cct\<c-x>\<c-l>\<c-n>\<c-n>\<c-n>\<c-n>\<esc>", 'tnix')
13215
ae5f855a64be patch 8.0.1482: using feedkeys() does not work to test completion
Christian Brabandt <cb@256bit.org>
parents: 12696
diff changeset
638 call assert_equal(['one', 'two', 'three', 't', '', '', ''], getline(1, '$'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
639 call feedkeys("cct\<c-x>\<c-l>\<c-p>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
640 call assert_equal(['one', 'two', 'three', 'two', '', '', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
641 call feedkeys("cct\<c-x>\<c-l>\<c-p>\<c-p>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
642 call assert_equal(['one', 'two', 'three', 't', '', '', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
643 call feedkeys("cct\<c-x>\<c-l>\<c-p>\<c-p>\<c-p>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
644 call assert_equal(['one', 'two', 'three', 'three', '', '', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
645 set complete=
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
646 call cursor(5, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
647 call feedkeys("A\<c-x>\<c-l>\<c-p>\<c-n>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
648 call assert_equal(['one', 'two', 'three', 'three', "\<c-l>\<c-p>\<c-n>", '', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
649 set complete&
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
650 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
651 if has("conceal") && has("syntax")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
652 call setline(1, ['foo', 'bar', 'foobar'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
653 call test_override("char_avail", 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
654 set conceallevel=2 concealcursor=n
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
655 syn on
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
656 syn match ErrorMsg "^bar"
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
657 call matchadd("Conceal", 'oo', 10, -1, {'conceal': 'X'})
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
658 func! DoIt()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
659 let g:change=1
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
660 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
661 au! TextChangedI <buffer> :call DoIt()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
662
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
663 call cursor(2, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
664 call assert_false(exists("g:change"))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
665 call feedkeys("A \<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
666 call assert_equal(['foo', 'bar ', 'foobar'], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
667 call assert_equal(1, g:change)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
668
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
669 call test_override("char_avail", 0)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
670 call clearmatches()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
671 syn off
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
672 au! TextChangedI
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
673 delfu DoIt
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
674 unlet! g:change
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
675 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
676 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
677 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
678
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
679 func! Test_edit_CTRL_N()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
680 " Check keyword completion
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
681 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
682 set complete=.
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
683 call setline(1, ['INFER', 'loWER', '', '', ])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
684 call cursor(3, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
685 call feedkeys("Ai\<c-n>\<cr>\<esc>", "tnix")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
686 call feedkeys("ILO\<c-n>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
687 call assert_equal(['INFER', 'loWER', 'i', 'LO', '', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
688 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
689 call setline(1, ['INFER', 'loWER', '', '', ])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
690 call cursor(3, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
691 set ignorecase infercase
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
692 call feedkeys("Ii\<c-n>\<cr>\<esc>", "tnix")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
693 call feedkeys("ILO\<c-n>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
694 call assert_equal(['INFER', 'loWER', 'infer', 'LOWER', '', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
695
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
696 set noignorecase noinfercase complete&
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
697 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
698 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
699
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
700 func! Test_edit_CTRL_O()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
701 " Check for CTRL-O in insert mode
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
702 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
703 inoreabbr <buffer> h here some more
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
704 call setline(1, ['abc', 'def'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
705 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
706 " Ctrl-O after an abbreviation
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
707 exe "norm A h\<c-o>:set nu\<cr> text"
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
708 call assert_equal(['abc here some more text', 'def'], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
709 call assert_true(&nu)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
710 set nonu
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
711 iunabbr <buffer> h
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
712 " Ctrl-O at end of line with 've'=onemore
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
713 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
714 call feedkeys("A\<c-o>:let g:a=getpos('.')\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
715 call assert_equal([0, 1, 23, 0], g:a)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
716 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
717 set ve=onemore
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
718 call feedkeys("A\<c-o>:let g:a=getpos('.')\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
719 call assert_equal([0, 1, 24, 0], g:a)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
720 set ve=
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
721 unlet! g:a
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
722 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
723 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
724
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
725 func! Test_edit_CTRL_R()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
726 " Insert Register
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
727 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
728 call test_override("ALL", 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
729 set showcmd
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
730 call feedkeys("AFOOBAR eins zwei\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
731 call feedkeys("O\<c-r>.", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
732 call feedkeys("O\<c-r>=10*500\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
733 call feedkeys("O\<c-r>=getreg('=', 1)\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
734 call assert_equal(["getreg('=', 1)", '5000', "FOOBAR eins zwei", "FOOBAR eins zwei"], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
735 call test_override("ALL", 0)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
736 set noshowcmd
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
737 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
738 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
739
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
740 func! Test_edit_CTRL_S()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
741 " Test pressing CTRL-S (basically only spellfile completion)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
742 " the rest is already covered
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
743 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
744 if !has("spell")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
745 call setline(1, 'vim')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
746 call feedkeys("A\<c-x>ss\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
747 call assert_equal(['vims', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
748 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
749 return
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
750 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
751 call setline(1, 'vim')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
752 " spell option not yet set
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
753 try
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
754 call feedkeys("A\<c-x>\<c-s>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
755 catch /^Vim\%((\a\+)\)\=:E756/
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
756 call assert_true(1, 'error caught')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
757 endtry
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
758 call assert_equal(['vim', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
759 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
760 setl spell spelllang=en
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
761 call setline(1, 'vim')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
762 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
763 call feedkeys("A\<c-x>\<c-s>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
764 call assert_equal(['Vim', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
765 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
766 call setline(1, 'vim')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
767 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
768 call feedkeys("A\<c-x>\<c-s>\<down>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
769 call assert_equal(['Aim'], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
770 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
771 call setline(1, 'vim')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
772 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
773 call feedkeys("A\<c-x>\<c-s>\<c-p>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
774 call assert_equal(['vim', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
775 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
776 " empty buffer
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
777 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
778 call feedkeys("A\<c-x>\<c-s>\<c-p>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
779 call assert_equal(['', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
780 setl nospell
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
781 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
782 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
783
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
784 func! Test_edit_CTRL_T()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
785 " Check for CTRL-T and CTRL-X CTRL-T in insert mode
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
786 " 1) increase indent
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
787 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
788 call setline(1, "abc")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
789 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
790 call feedkeys("A\<c-t>xyz", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
791 call assert_equal(["\<tab>abcxyz"], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
792 " 2) also when paste option is set
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
793 set paste
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
794 call setline(1, "abc")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
795 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
796 call feedkeys("A\<c-t>xyz", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
797 call assert_equal(["\<tab>abcxyz"], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
798 set nopaste
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
799 " CTRL-X CTRL-T (thesaurus complete)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
800 call writefile(['angry furious mad enraged'], 'Xthesaurus')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
801 set thesaurus=Xthesaurus
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
802 call setline(1, 'mad')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
803 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
804 call feedkeys("A\<c-x>\<c-t>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
805 call assert_equal(['mad', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
806 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
807 call setline(1, 'mad')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
808 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
809 call feedkeys("A\<c-x>\<c-t>\<c-n>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
810 call assert_equal(['angry', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
811 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
812 call setline(1, 'mad')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
813 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
814 call feedkeys("A\<c-x>\<c-t>\<c-n>\<c-n>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
815 call assert_equal(['furious', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
816 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
817 call setline(1, 'mad')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
818 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
819 call feedkeys("A\<c-x>\<c-t>\<c-n>\<c-n>\<c-n>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
820 call assert_equal(['enraged', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
821 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
822 call setline(1, 'mad')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
823 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
824 call feedkeys("A\<c-x>\<c-t>\<c-n>\<c-n>\<c-n>\<c-n>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
825 call assert_equal(['mad', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
826 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
827 call setline(1, 'mad')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
828 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
829 call feedkeys("A\<c-x>\<c-t>\<c-n>\<c-n>\<c-n>\<c-n>\<c-n>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
830 call assert_equal(['mad', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
831 " Using <c-p> <c-n> when 'complete' is empty
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
832 set complete=
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
833 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
834 call setline(1, 'mad')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
835 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
836 call feedkeys("A\<c-x>\<c-t>\<c-n>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
837 call assert_equal(['angry', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
838 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
839 call setline(1, 'mad')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
840 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
841 call feedkeys("A\<c-x>\<c-t>\<c-p>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
842 call assert_equal(['mad', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
843 set complete&
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
844
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
845 set thesaurus=
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
846 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
847 call setline(1, 'mad')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
848 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
849 let v:testing = 1
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
850 try
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
851 call feedkeys("A\<c-x>\<c-t>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
852 catch
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
853 " error sleeps 2 seconds, when v:testing is not set
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
854 let v:testing = 0
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
855 endtry
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
856 call assert_equal(['mad'], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
857 call delete('Xthesaurus')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
858 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
859 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
860
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
861 func! Test_edit_CTRL_U()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
862 " Test 'completefunc'
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
863 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
864 " -1, -2 and -3 are special return values
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
865 let g:special=0
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
866 fun! CompleteMonths(findstart, base)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
867 if a:findstart
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
868 " locate the start of the word
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
869 return g:special
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
870 else
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
871 " find months matching with "a:base"
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
872 let res = []
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
873 for m in split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
874 if m =~ '^\c'.a:base
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
875 call add(res, {'word': m, 'abbr': m.' Month', 'icase': 0})
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
876 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
877 endfor
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
878 return {'words': res, 'refresh': 'always'}
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
879 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
880 endfun
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
881 set completefunc=CompleteMonths
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
882 call setline(1, ['', ''])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
883 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
884 call feedkeys("AX\<c-x>\<c-u>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
885 call assert_equal(['X', '', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
886 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
887 let g:special=-1
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
888 call feedkeys("AX\<c-x>\<c-u>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
889 call assert_equal(['XJan', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
890 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
891 let g:special=-2
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
892 call feedkeys("AX\<c-x>\<c-u>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
893 call assert_equal(['X', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
894 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
895 let g:special=-3
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
896 call feedkeys("AX\<c-x>\<c-u>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
897 call assert_equal(['X', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
898 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
899 let g:special=0
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
900 call feedkeys("AM\<c-x>\<c-u>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
901 call assert_equal(['Mar', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
902 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
903 call feedkeys("AM\<c-x>\<c-u>\<c-n>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
904 call assert_equal(['May', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
905 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
906 call feedkeys("AM\<c-x>\<c-u>\<c-n>\<c-n>\<cr>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
907 call assert_equal(['M', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
908 delfu CompleteMonths
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
909 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
910 try
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
911 call feedkeys("A\<c-x>\<c-u>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
912 call assert_fails(1, 'unknown completion function')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
913 catch /^Vim\%((\a\+)\)\=:E117/
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
914 call assert_true(1, 'E117 error caught')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
915 endtry
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
916 set completefunc=
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
917 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
918 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
919
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
920 func! Test_edit_CTRL_Z()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
921 " Ctrl-Z when insertmode is not set inserts it literally
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
922 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
923 call setline(1, 'abc')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
924 call feedkeys("A\<c-z>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
925 call assert_equal(["abc\<c-z>"], getline(1,'$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
926 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
927 " TODO: How to Test Ctrl-Z in insert mode, e.g. suspend?
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
928 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
929
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
930 func! Test_edit_DROP()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
931 if !has("dnd")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
932 return
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
933 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
934 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
935 call setline(1, ['abc def ghi'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
936 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
937 try
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
938 call feedkeys("i\<Drop>\<Esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
939 call assert_fails(1, 'Invalid register name')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
940 catch /^Vim\%((\a\+)\)\=:E353/
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
941 call assert_true(1, 'error caught')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
942 endtry
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
943 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
944 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
945
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
946 func! Test_edit_CTRL_V()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
947 if has("ebcdic")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
948 return
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
949 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
950 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
951 call setline(1, ['abc'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
952 call cursor(2, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
953 " force some redraws
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
954 set showmode showcmd
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
955 "call test_override_char_avail(1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
956 call test_override('ALL', 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
957 call feedkeys("A\<c-v>\<c-n>\<c-v>\<c-l>\<c-v>\<c-b>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
958 call assert_equal(["abc\x0e\x0c\x02"], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
959
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
960 if has("rightleft") && exists("+rl")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
961 set rl
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
962 call setline(1, ['abc'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
963 call cursor(2, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
964 call feedkeys("A\<c-v>\<c-n>\<c-v>\<c-l>\<c-v>\<c-b>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
965 call assert_equal(["abc\x0e\x0c\x02"], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
966 set norl
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
967 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
968
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
969 call test_override('ALL', 0)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
970 set noshowmode showcmd
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
971 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
972 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
973
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
974 func! Test_edit_F1()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
975 " Pressing <f1>
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
976 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
977 call feedkeys(":set im\<cr>\<f1>\<c-l>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
978 set noinsertmode
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
979 call assert_equal('help', &buftype)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
980 bw
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
981 bw
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
982 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
983
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
984 func! Test_edit_F21()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
985 " Pressing <f21>
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
986 " sends a netbeans command
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
987 if has("netbeans_intg")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
988 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
989 " I have no idea what this is supposed to do :)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
990 call feedkeys("A\<F21>\<F1>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
991 bw
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
992 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
993 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
994
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
995 func! Test_edit_HOME_END()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
996 " Test Home/End Keys
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
997 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
998 set foldopen+=hor
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
999 call setline(1, ['abc', 'def'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1000 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1001 call feedkeys("AX\<Home>Y\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1002 call cursor(2, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1003 call feedkeys("iZ\<End>Y\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1004 call assert_equal(['YabcX', 'ZdefY'], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1005
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1006 set foldopen-=hor
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1007 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1008 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1009
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1010 func! Test_edit_INS()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1011 " Test for Pressing <Insert>
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1012 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1013 call setline(1, ['abc', 'def'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1014 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1015 call feedkeys("i\<Insert>ZYX>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1016 call assert_equal(['ZYX>', 'def'], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1017 call setline(1, ['abc', 'def'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1018 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1019 call feedkeys("i\<Insert>Z\<Insert>YX>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1020 call assert_equal(['ZYX>bc', 'def'], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1021 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1022 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1023
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1024 func! Test_edit_LEFT_RIGHT()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1025 " Left, Shift-Left, Right, Shift-Right
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1026 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1027 call setline(1, ['abc def ghi', 'ABC DEF GHI', 'ZZZ YYY XXX'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1028 let _ww=&ww
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1029 set ww=
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1030 call cursor(2, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1031 call feedkeys("i\<left>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1032 call assert_equal([0, 2, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1033 " Is this a bug, <s-left> does not respect whichwrap option
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1034 call feedkeys("i\<s-left>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1035 call assert_equal([0, 1, 8, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1036 call feedkeys("i". repeat("\<s-left>", 3). "\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1037 call assert_equal([0, 1, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1038 call feedkeys("i\<right>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1039 call assert_equal([0, 1, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1040 call feedkeys("i\<right>\<right>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1041 call assert_equal([0, 1, 2, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1042 call feedkeys("A\<right>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1043 call assert_equal([0, 1, 11, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1044 call feedkeys("A\<s-right>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1045 call assert_equal([0, 2, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1046 call feedkeys("i\<s-right>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1047 call assert_equal([0, 2, 4, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1048 call cursor(3, 11)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1049 call feedkeys("A\<right>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1050 call feedkeys("A\<s-right>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1051 call assert_equal([0, 3, 11, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1052 call cursor(2, 11)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1053 " <S-Right> does not respect 'whichwrap' option
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1054 call feedkeys("A\<s-right>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1055 call assert_equal([0, 3, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1056 " Check motion when 'whichwrap' contains cursor keys for insert mode
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1057 set ww+=[,]
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1058 call cursor(2, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1059 call feedkeys("i\<left>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1060 call assert_equal([0, 1, 11, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1061 call cursor(2, 11)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1062 call feedkeys("A\<right>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1063 call assert_equal([0, 3, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1064 call cursor(2, 11)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1065 call feedkeys("A\<s-right>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1066 call assert_equal([0, 3, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1067 let &ww = _ww
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1068 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1069 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1070
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1071 func! Test_edit_MOUSE()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1072 " This is a simple test, since we not really using the mouse here
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1073 if !has("mouse")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1074 return
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1075 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1076 10new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1077 call setline(1, range(1, 100))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1078 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1079 set mouse=a
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1080 call feedkeys("A\<ScrollWheelDown>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1081 call assert_equal([0, 4, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1082 " This should move by one pageDown, but only moves
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1083 " by one line when the test is run...
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1084 call feedkeys("A\<S-ScrollWheelDown>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1085 call assert_equal([0, 5, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1086 set nostartofline
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1087 call feedkeys("A\<C-ScrollWheelDown>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1088 call assert_equal([0, 6, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1089 call feedkeys("A\<LeftMouse>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1090 call assert_equal([0, 6, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1091 call feedkeys("A\<RightMouse>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1092 call assert_equal([0, 6, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1093 call cursor(1, 100)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1094 norm! zt
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1095 " this should move by a screen up, but when the test
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1096 " is run, it moves up to the top of the buffer...
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1097 call feedkeys("A\<ScrollWheelUp>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1098 call assert_equal([0, 1, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1099 call cursor(1, 30)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1100 norm! zt
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1101 call feedkeys("A\<S-ScrollWheelUp>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1102 call assert_equal([0, 1, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1103 call cursor(1, 30)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1104 norm! zt
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1105 call feedkeys("A\<C-ScrollWheelUp>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1106 call assert_equal([0, 1, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1107 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1108 call setline(1, repeat(["12345678901234567890"], 100))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1109 call cursor(2, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1110 call feedkeys("A\<ScrollWheelRight>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1111 call assert_equal([0, 2, 20, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1112 call feedkeys("A\<ScrollWheelLeft>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1113 call assert_equal([0, 2, 20, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1114 call feedkeys("A\<S-ScrollWheelRight>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1115 call assert_equal([0, 2, 20, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1116 call feedkeys("A\<S-ScrollWheelLeft>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1117 call assert_equal([0, 2, 20, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1118 call feedkeys("A\<C-ScrollWheelRight>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1119 call assert_equal([0, 2, 20, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1120 call feedkeys("A\<C-ScrollWheelLeft>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1121 call assert_equal([0, 2, 20, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1122 set mouse& startofline
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1123 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1124 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1125
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1126 func! Test_edit_PAGEUP_PAGEDOWN()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1127 10new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1128 call setline(1, repeat(['abc def ghi'], 30))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1129 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1130 call feedkeys("i\<PageDown>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1131 call assert_equal([0, 9, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1132 call feedkeys("i\<PageDown>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1133 call assert_equal([0, 17, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1134 call feedkeys("i\<PageDown>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1135 call assert_equal([0, 25, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1136 call feedkeys("i\<PageDown>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1137 call assert_equal([0, 30, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1138 call feedkeys("i\<PageDown>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1139 call assert_equal([0, 30, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1140 call feedkeys("A\<PageUp>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1141 call assert_equal([0, 29, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1142 call feedkeys("A\<PageUp>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1143 call assert_equal([0, 21, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1144 call feedkeys("A\<PageUp>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1145 call assert_equal([0, 13, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1146 call feedkeys("A\<PageUp>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1147 call assert_equal([0, 5, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1148 call feedkeys("A\<PageUp>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1149 call assert_equal([0, 5, 11, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1150 " <S-Up> is the same as <PageUp>
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1151 " <S-Down> is the same as <PageDown>
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1152 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1153 call feedkeys("i\<S-Down>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1154 call assert_equal([0, 9, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1155 call feedkeys("i\<S-Down>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1156 call assert_equal([0, 17, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1157 call feedkeys("i\<S-Down>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1158 call assert_equal([0, 25, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1159 call feedkeys("i\<S-Down>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1160 call assert_equal([0, 30, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1161 call feedkeys("i\<S-Down>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1162 call assert_equal([0, 30, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1163 call feedkeys("A\<S-Up>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1164 call assert_equal([0, 29, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1165 call feedkeys("A\<S-Up>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1166 call assert_equal([0, 21, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1167 call feedkeys("A\<S-Up>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1168 call assert_equal([0, 13, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1169 call feedkeys("A\<S-Up>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1170 call assert_equal([0, 5, 1, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1171 call feedkeys("A\<S-Up>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1172 call assert_equal([0, 5, 11, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1173 set nostartofline
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1174 call cursor(30, 11)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1175 norm! zt
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1176 call feedkeys("A\<PageUp>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1177 call assert_equal([0, 29, 11, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1178 call feedkeys("A\<PageUp>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1179 call assert_equal([0, 21, 11, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1180 call feedkeys("A\<PageUp>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1181 call assert_equal([0, 13, 11, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1182 call feedkeys("A\<PageUp>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1183 call assert_equal([0, 5, 11, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1184 call feedkeys("A\<PageUp>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1185 call assert_equal([0, 5, 11, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1186 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1187 call feedkeys("A\<PageDown>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1188 call assert_equal([0, 9, 11, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1189 call feedkeys("A\<PageDown>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1190 call assert_equal([0, 17, 11, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1191 call feedkeys("A\<PageDown>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1192 call assert_equal([0, 25, 11, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1193 call feedkeys("A\<PageDown>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1194 call assert_equal([0, 30, 11, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1195 call feedkeys("A\<PageDown>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1196 call assert_equal([0, 30, 11, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1197 " <S-Up> is the same as <PageUp>
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1198 " <S-Down> is the same as <PageDown>
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1199 call cursor(30, 11)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1200 norm! zt
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1201 call feedkeys("A\<S-Up>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1202 call assert_equal([0, 29, 11, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1203 call feedkeys("A\<S-Up>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1204 call assert_equal([0, 21, 11, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1205 call feedkeys("A\<S-Up>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1206 call assert_equal([0, 13, 11, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1207 call feedkeys("A\<S-Up>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1208 call assert_equal([0, 5, 11, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1209 call feedkeys("A\<S-Up>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1210 call assert_equal([0, 5, 11, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1211 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1212 call feedkeys("A\<S-Down>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1213 call assert_equal([0, 9, 11, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1214 call feedkeys("A\<S-Down>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1215 call assert_equal([0, 17, 11, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1216 call feedkeys("A\<S-Down>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1217 call assert_equal([0, 25, 11, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1218 call feedkeys("A\<S-Down>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1219 call assert_equal([0, 30, 11, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1220 call feedkeys("A\<S-Down>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1221 call assert_equal([0, 30, 11, 0], getpos('.'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1222 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1223 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1224
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1225 func! Test_edit_forbidden()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1226 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1227 " 1) edit in the sandbox is not allowed
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1228 call setline(1, 'a')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1229 com! Sandbox :sandbox call feedkeys("i\<del>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1230 call assert_fails(':Sandbox', 'E48:')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1231 com! Sandbox :sandbox exe "norm! i\<del>"
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1232 call assert_fails(':Sandbox', 'E48:')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1233 delcom Sandbox
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1234 call assert_equal(['a'], getline(1,'$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1235 " 2) edit with textlock set
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1236 fu! DoIt()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1237 call feedkeys("i\<del>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1238 endfu
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1239 au InsertCharPre <buffer> :call DoIt()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1240 try
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1241 call feedkeys("ix\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1242 call assert_fails(1, 'textlock')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1243 catch /^Vim\%((\a\+)\)\=:E523/ " catch E523: not allowed here
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1244 endtry
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1245 " TODO: Might be a bug: should x really be inserted here
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1246 call assert_equal(['xa'], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1247 delfu DoIt
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1248 try
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1249 call feedkeys("ix\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1250 call assert_fails(1, 'unknown function')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1251 catch /^Vim\%((\a\+)\)\=:E117/ " catch E117: unknown function
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1252 endtry
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1253 au! InsertCharPre
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1254 " 3) edit when completion is shown
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1255 fun! Complete(findstart, base)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1256 if a:findstart
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1257 return col('.')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1258 else
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1259 call feedkeys("i\<del>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1260 return []
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1261 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1262 endfun
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1263 set completefunc=Complete
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1264 try
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1265 call feedkeys("i\<c-x>\<c-u>\<esc>", 'tnix')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1266 call assert_fails(1, 'change in complete function')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1267 catch /^Vim\%((\a\+)\)\=:E523/ " catch E523
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1268 endtry
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1269 delfu Complete
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1270 set completefunc=
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1271 if has("rightleft") && exists("+fkmap")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1272 " 4) 'R' when 'fkmap' and 'revins' is set.
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1273 set revins fkmap
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1274 try
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1275 normal Ri
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1276 call assert_fails(1, "R with 'fkmap' and 'ri' set")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1277 catch
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1278 finally
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1279 set norevins nofkmap
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1280 endtry
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1281 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1282 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1283 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1284
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1285 func! Test_edit_rightleft()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1286 " Cursor in rightleft mode moves differently
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1287 if !exists("+rightleft")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1288 return
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1289 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1290 call NewWindow(10, 20)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1291 call setline(1, ['abc', 'def', 'ghi'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1292 call cursor(1, 2)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1293 set rightleft
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1294 " Screen looks as expected
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1295 let lines = ScreenLines([1, 4], winwidth(0))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1296 let expect = [
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1297 \" cba",
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1298 \" fed",
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1299 \" ihg",
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1300 \" ~"]
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1301 call assert_equal(join(expect, "\n"), join(lines, "\n"))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1302 " 2) right moves to the left
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1303 call feedkeys("i\<right>\<esc>x", 'txin')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1304 call assert_equal(['bc', 'def', 'ghi'], getline(1,'$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1305 call cursor(1, 2)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1306 call feedkeys("i\<s-right>\<esc>", 'txin')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1307 call cursor(1, 2)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1308 call feedkeys("i\<c-right>\<esc>", 'txin')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1309 " Screen looks as expected
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1310 let lines = ScreenLines([1, 4], winwidth(0))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1311 let expect = [
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1312 \" cb",
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1313 \" fed",
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1314 \" ihg",
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1315 \" ~"]
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1316 call assert_equal(join(expect, "\n"), join(lines, "\n"))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1317 " 2) left moves to the right
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1318 call setline(1, ['abc', 'def', 'ghi'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1319 call cursor(1, 2)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1320 call feedkeys("i\<left>\<esc>x", 'txin')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1321 call assert_equal(['ac', 'def', 'ghi'], getline(1,'$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1322 call cursor(1, 2)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1323 call feedkeys("i\<s-left>\<esc>", 'txin')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1324 call cursor(1, 2)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1325 call feedkeys("i\<c-left>\<esc>", 'txin')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1326 " Screen looks as expected
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1327 let lines = ScreenLines([1, 4], winwidth(0))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1328 let expect = [
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1329 \" ca",
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1330 \" fed",
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1331 \" ihg",
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1332 \" ~"]
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1333 call assert_equal(join(expect, "\n"), join(lines, "\n"))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1334 set norightleft
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1335 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1336 endfunc
11289
e0309111d976 patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents: 11171
diff changeset
1337
e0309111d976 patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents: 11171
diff changeset
1338 func Test_edit_complete_very_long_name()
11319
2dc624388934 patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents: 11315
diff changeset
1339 if !has('unix')
11291
783ec3826b0c patch 8.0.0531: test with long directory name fails on non-unix systems
Christian Brabandt <cb@256bit.org>
parents: 11289
diff changeset
1340 " Long directory names only work on Unix.
783ec3826b0c patch 8.0.0531: test with long directory name fails on non-unix systems
Christian Brabandt <cb@256bit.org>
parents: 11289
diff changeset
1341 return
783ec3826b0c patch 8.0.0531: test with long directory name fails on non-unix systems
Christian Brabandt <cb@256bit.org>
parents: 11289
diff changeset
1342 endif
11319
2dc624388934 patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents: 11315
diff changeset
1343
2dc624388934 patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents: 11315
diff changeset
1344 let dirname = getcwd() . "/Xdir"
2dc624388934 patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents: 11315
diff changeset
1345 let longdirname = dirname . repeat('/' . repeat('d', 255), 4)
2dc624388934 patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents: 11315
diff changeset
1346 try
2dc624388934 patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents: 11315
diff changeset
1347 call mkdir(longdirname, 'p')
2dc624388934 patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents: 11315
diff changeset
1348 catch /E739:/
2dc624388934 patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents: 11315
diff changeset
1349 " Long directory name probably not supported.
2dc624388934 patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents: 11315
diff changeset
1350 call delete(dirname, 'rf')
2dc624388934 patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents: 11315
diff changeset
1351 return
2dc624388934 patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents: 11315
diff changeset
1352 endtry
2dc624388934 patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents: 11315
diff changeset
1353
11315
0c091a7c588c patch 8.0.0543: test_edit causes older xfce4-terminal to close
Christian Brabandt <cb@256bit.org>
parents: 11293
diff changeset
1354 " Try to get the Vim window position before setting 'columns'.
0c091a7c588c patch 8.0.0543: test_edit causes older xfce4-terminal to close
Christian Brabandt <cb@256bit.org>
parents: 11293
diff changeset
1355 let winposx = getwinposx()
0c091a7c588c patch 8.0.0543: test_edit causes older xfce4-terminal to close
Christian Brabandt <cb@256bit.org>
parents: 11293
diff changeset
1356 let winposy = getwinposy()
11289
e0309111d976 patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents: 11171
diff changeset
1357 let save_columns = &columns
11319
2dc624388934 patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents: 11315
diff changeset
1358 " Need at least about 1100 columns to reproduce the problem.
11315
0c091a7c588c patch 8.0.0543: test_edit causes older xfce4-terminal to close
Christian Brabandt <cb@256bit.org>
parents: 11293
diff changeset
1359 set columns=2000
11289
e0309111d976 patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents: 11171
diff changeset
1360 set noswapfile
11315
0c091a7c588c patch 8.0.0543: test_edit causes older xfce4-terminal to close
Christian Brabandt <cb@256bit.org>
parents: 11293
diff changeset
1361
11289
e0309111d976 patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents: 11171
diff changeset
1362 let longfilename = longdirname . '/' . repeat('a', 255)
e0309111d976 patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents: 11171
diff changeset
1363 call writefile(['Totum', 'Table'], longfilename)
e0309111d976 patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents: 11171
diff changeset
1364 new
e0309111d976 patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents: 11171
diff changeset
1365 exe "next Xfile " . longfilename
e0309111d976 patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents: 11171
diff changeset
1366 exe "normal iT\<C-N>"
e0309111d976 patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents: 11171
diff changeset
1367
e0309111d976 patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents: 11171
diff changeset
1368 bwipe!
e0309111d976 patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents: 11171
diff changeset
1369 exe 'bwipe! ' . longfilename
e0309111d976 patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents: 11171
diff changeset
1370 call delete(dirname, 'rf')
e0309111d976 patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents: 11171
diff changeset
1371 let &columns = save_columns
11315
0c091a7c588c patch 8.0.0543: test_edit causes older xfce4-terminal to close
Christian Brabandt <cb@256bit.org>
parents: 11293
diff changeset
1372 if winposx >= 0 && winposy >= 0
0c091a7c588c patch 8.0.0543: test_edit causes older xfce4-terminal to close
Christian Brabandt <cb@256bit.org>
parents: 11293
diff changeset
1373 exe 'winpos ' . winposx . ' ' . winposy
0c091a7c588c patch 8.0.0543: test_edit causes older xfce4-terminal to close
Christian Brabandt <cb@256bit.org>
parents: 11293
diff changeset
1374 endif
11289
e0309111d976 patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents: 11171
diff changeset
1375 set swapfile&
e0309111d976 patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents: 11171
diff changeset
1376 endfunc
12654
d03798bddf5e patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
1377
14409
9ffce640d0d3 patch 8.1.0219: expanding ## fails to escape backtick
Christian Brabandt <cb@256bit.org>
parents: 14039
diff changeset
1378 func Test_edit_backtick()
9ffce640d0d3 patch 8.1.0219: expanding ## fails to escape backtick
Christian Brabandt <cb@256bit.org>
parents: 14039
diff changeset
1379 next a\`b c
9ffce640d0d3 patch 8.1.0219: expanding ## fails to escape backtick
Christian Brabandt <cb@256bit.org>
parents: 14039
diff changeset
1380 call assert_equal('a`b', expand('%'))
9ffce640d0d3 patch 8.1.0219: expanding ## fails to escape backtick
Christian Brabandt <cb@256bit.org>
parents: 14039
diff changeset
1381 next
9ffce640d0d3 patch 8.1.0219: expanding ## fails to escape backtick
Christian Brabandt <cb@256bit.org>
parents: 14039
diff changeset
1382 call assert_equal('c', expand('%'))
9ffce640d0d3 patch 8.1.0219: expanding ## fails to escape backtick
Christian Brabandt <cb@256bit.org>
parents: 14039
diff changeset
1383 call assert_equal('a\`b c', expand('##'))
9ffce640d0d3 patch 8.1.0219: expanding ## fails to escape backtick
Christian Brabandt <cb@256bit.org>
parents: 14039
diff changeset
1384 endfunc
9ffce640d0d3 patch 8.1.0219: expanding ## fails to escape backtick
Christian Brabandt <cb@256bit.org>
parents: 14039
diff changeset
1385
12654
d03798bddf5e patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
1386 func Test_edit_quit()
d03798bddf5e patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
1387 edit foo.txt
d03798bddf5e patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
1388 split
d03798bddf5e patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
1389 new
d03798bddf5e patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
1390 call setline(1, 'hello')
d03798bddf5e patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
1391 3wincmd w
d03798bddf5e patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
1392 redraw!
d03798bddf5e patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
1393 call assert_fails('1q', 'E37:')
d03798bddf5e patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
1394 bwipe! foo.txt
d03798bddf5e patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
1395 only
d03798bddf5e patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
1396 endfunc
d03798bddf5e patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
1397
14033
bcda3b864c31 patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
1398 func Test_edit_alt()
bcda3b864c31 patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
1399 " Keeping the cursor line didn't happen when the first line has indent.
bcda3b864c31 patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
1400 new
bcda3b864c31 patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
1401 call setline(1, [' one', 'two', 'three'])
bcda3b864c31 patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
1402 w XAltFile
bcda3b864c31 patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
1403 $
bcda3b864c31 patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
1404 call assert_equal(3, line('.'))
bcda3b864c31 patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
1405 e Xother
bcda3b864c31 patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
1406 e #
bcda3b864c31 patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
1407 call assert_equal(3, line('.'))
bcda3b864c31 patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
1408
bcda3b864c31 patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
1409 bwipe XAltFile
bcda3b864c31 patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
1410 call delete('XAltFile')
bcda3b864c31 patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
1411 endfunc
14985
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1412
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1413 func Test_leave_insert_autocmd()
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1414 new
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1415 au InsertLeave * let g:did_au = 1
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1416 let g:did_au = 0
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1417 call feedkeys("afoo\<Esc>", 'tx')
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1418 call assert_equal(1, g:did_au)
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1419 call assert_equal('foo', getline(1))
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1420
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1421 let g:did_au = 0
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1422 call feedkeys("Sbar\<C-C>", 'tx')
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1423 call assert_equal(0, g:did_au)
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1424 call assert_equal('bar', getline(1))
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1425
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1426 inoremap x xx<Esc>
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1427 let g:did_au = 0
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1428 call feedkeys("Saax", 'tx')
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1429 call assert_equal(1, g:did_au)
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1430 call assert_equal('aaxx', getline(1))
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1431
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1432 inoremap x xx<C-C>
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1433 let g:did_au = 0
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1434 call feedkeys("Sbbx", 'tx')
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1435 call assert_equal(0, g:did_au)
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1436 call assert_equal('bbxx', getline(1))
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1437
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1438 bwipe!
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1439 au! InsertLeave
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1440 iunmap x
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1441 endfunc