annotate src/testdir/test_edit.vim @ 35172:c98f002b1fe4 default tip

runtime(doc): fix typo in usr_52.txt Commit: https://github.com/vim/vim/commit/b7258738f80f26be302a84a99f968b3bdc2f29bb Author: Christian Brabandt <cb@256bit.org> Date: Sun May 12 19:04:47 2024 +0200 runtime(doc): fix typo in usr_52.txt fixes: https://github.com/vim/vim/issues/14758 Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Sun, 12 May 2024 19:15:08 +0200
parents 1e6f45f5ca23
children
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
18538
c4d97a18af37 patch 8.1.2263: 'noesckeys' test fails in GUI
Bram Moolenaar <Bram@vim.org>
parents: 18534
diff changeset
2
11105
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
18538
c4d97a18af37 patch 8.1.2263: 'noesckeys' test fails in GUI
Bram Moolenaar <Bram@vim.org>
parents: 18534
diff changeset
7 source check.vim
32194
baafb135b0cb patch 9.0.1428: cursor in wrong position when leaving insert mode
Bram Moolenaar <Bram@vim.org>
parents: 32049
diff changeset
8 source screendump.vim
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 source view_util.vim
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 " 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
12 " fixed: https://groups.google.com/d/msg/vim_dev/fXL9yme4H4c/bOR-U6_bAQAJ
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
13 func Test_edit_00b()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 call setline(1, ['abc '])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 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
17 call cursor(1, 4)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 " <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
19 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
20 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
21 iunabbr <buffer> h
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
25 func Test_edit_01()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 " set for Travis CI?
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 " set nocp noesckeys
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 " 1) empty buffer
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 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
31 " 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
32 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
33 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
34 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 " 3) delete one character
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 call setline(1, 'a')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 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
38 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
39 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 " 4) delete a multibyte character
15607
2dcaa860e3fc patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
41 call setline(1, "\u0401")
2dcaa860e3fc patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
42 call feedkeys("i\<del>\<esc>", 'tnix')
2dcaa860e3fc patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
43 call assert_equal([''], getline(1,'$'))
2dcaa860e3fc patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
44 %d
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 " 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
46 let _bs=&bs
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 set bs=eol
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 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
49 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 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
51 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
52 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 " 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
54 set bs=
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 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
56 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 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
58 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
59 let &bs=_bs
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
63 func Test_edit_02()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 " 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
65 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 call setline(1, 'abc')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 fu! DoIt(...)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 call cursor(1, 4)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 if len(a:000)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 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
72 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 endfu
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 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
75 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
76 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
77 " Setting <Enter> in InsertCharPre
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 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
79 call setline(1, 'abc')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 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
82 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
83 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 au! InsertCharPre
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 " 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
86 " 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
87 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
88 call setline(1, 'abc')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 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
91 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
92 " 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
93 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
94 call setline(1, 'abc')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 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
97 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
98 au! InsertEnter
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 delfu DoIt
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
103 func Test_edit_03()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104 " 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
105 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
106 call setline(1, 'abc')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
108 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
109 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
110 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 call setline(1, 'abc')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113 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
114 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
115 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
116 call setline(1, 'abc')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117 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
118 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
119 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
120 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
122 func Test_edit_04()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123 " test for :stopinsert
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 call setline(1, 'abc')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127 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
128 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
129 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
130 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
131 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
134 func Test_edit_05()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
135 " 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
136 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
137 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
138 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
139 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
140 " 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
141 norm! Vjzf
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
142 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
143 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
144 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
145 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
146 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
147 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
148 " 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
149 norm! Vjzf
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
150 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
151 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
152 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
153 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
154 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
155
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
156 func Test_edit_06()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
157 " Test in diff mode
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
158 CheckFeature diff
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
159 CheckExecutable diff
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
160 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
161 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
162 vnew
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', 'zzz', 'xxx', 'yyy'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
164 wincmd p
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
165 diffthis
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 call cursor(2, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
170 norm! zt
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
171 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
172 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
173 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
174 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
175 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
177 func Test_edit_07()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
178 " 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
179 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
180 call setline(1, 'J')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
181
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
182 func! ListMonths()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
183 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
184 \ '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
185 \ 'October', 'November', 'December'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
186 return ''
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
187 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
188 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
189
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
190 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
191 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
192 " 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
193 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
194 call setline(1, 'J')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
195 fu! DoIt()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
196 if v:char=='u'
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
197 let v:char='an'
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
198 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
199 endfu
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
200 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
201 call feedkeys("A\<f5>\<c-p>u\<cr>\<c-l>\<cr>", 'tx')
17857
4935244c1128 patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 16692
diff changeset
202 call assert_equal(["Jan\<c-l>",''], 1->getline('$'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
203 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
204 call setline(1, 'J')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
205 call feedkeys("A\<f5>\<c-p>u\<down>\<c-l>\<cr>", 'tx')
17857
4935244c1128 patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 16692
diff changeset
206 call assert_equal(["January"], 1->getline('$'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
207
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
208 delfu ListMonths
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
209 delfu DoIt
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
210 iunmap <buffer> <f5>
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
211 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
212 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
213
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
214 func Test_edit_08()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
215 " 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
216 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
217 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
218 call setline(1, ['abc'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
219 call cursor(1, 4)
12696
6daad7ef16be patch 8.0.1226: edit and popup tests failing
Christian Brabandt <cb@256bit.org>
parents: 12654
diff changeset
220 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
221 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
222 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
223 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
224 bw!
12696
6daad7ef16be patch 8.0.1226: edit and popup tests failing
Christian Brabandt <cb@256bit.org>
parents: 12654
diff changeset
225 unlet g:bufnr
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
226 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
227
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
228 func Test_edit_09()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
229 " test i_CTRL-\ combinations
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
230 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
231 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
232 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
233 " 1) CTRL-\ CTLR-N
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
234 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
235 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
236 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
237 " 2) CTRL-\ CTLR-G
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
238 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
239 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
240 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
241 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
242 set noinsertmode
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
243 " 3) CTRL-\ CTRL-O
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
244 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
245 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
246 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
247 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
248 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
249 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
250 " 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
251 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
252 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
253 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
254 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
255 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
256 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
257
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
258 func Test_edit_11()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
259 " 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
260 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
261 set cindent
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
262 call setline(1, ['{', '', ''])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
263 call cursor(2, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
264 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
265 call cursor(3, 1)
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
266 call feedkeys("\<Insert>/* comment */", 'tnix')
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
267 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
268 " added changed cindentkeys slightly
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
269 set cindent cinkeys+=*/
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
270 call setline(1, ['{', '', ''])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
271 call cursor(2, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
272 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
273 call cursor(3, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
274 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
275 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
276 set cindent cinkeys+==end
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
277 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
278 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
279 set cinkeys-==end
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
280 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
281 " 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
282 func! Do_Indent()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
283 if v:lnum == 3
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
284 return 3*shiftwidth()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
285 else
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
286 return 2*shiftwidth()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
287 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
288 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
289 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
290 call setline(1, ['{', '', ''])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
291 call cursor(2, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
292 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
293 call cursor(3, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
294 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
295 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
296 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
297 set nocindent indentexpr=
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
298 delfu Do_Indent
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
299 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
300 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
301
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
302 func Test_edit_11_indentexpr()
12551
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
303 " Test that indenting kicks in
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
304 new
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
305 " Use indentexpr instead of cindenting
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
306 func! Do_Indent()
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
307 let pline=prevnonblank(v:lnum)
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
308 if empty(getline(v:lnum))
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
309 if getline(pline) =~ 'if\|then'
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
310 return shiftwidth()
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
311 else
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
312 return 0
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
313 endif
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
314 else
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
315 return 0
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
316 endif
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
317 endfunc
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
318 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
319 call setline(1, ['if [ $this ]'])
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
320 call cursor(1, 1)
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
321 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
322 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
323 set cinkeys&vim indentkeys&vim
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
324 set nocindent indentexpr=
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
325 delfu Do_Indent
26743
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26592
diff changeset
326
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26592
diff changeset
327 " Using a script-local function
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26592
diff changeset
328 func s:NewIndentExpr()
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26592
diff changeset
329 endfunc
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26592
diff changeset
330 set indentexpr=s:NewIndentExpr()
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26592
diff changeset
331 call assert_equal(expand('<SID>') .. 'NewIndentExpr()', &indentexpr)
31821
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30393
diff changeset
332 call assert_equal(expand('<SID>') .. 'NewIndentExpr()', &g:indentexpr)
26743
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26592
diff changeset
333 set indentexpr=<SID>NewIndentExpr()
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26592
diff changeset
334 call assert_equal(expand('<SID>') .. 'NewIndentExpr()', &indentexpr)
31821
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30393
diff changeset
335 call assert_equal(expand('<SID>') .. 'NewIndentExpr()', &g:indentexpr)
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30393
diff changeset
336 setlocal indentexpr=
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30393
diff changeset
337 setglobal indentexpr=s:NewIndentExpr()
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30393
diff changeset
338 call assert_equal(expand('<SID>') .. 'NewIndentExpr()', &g:indentexpr)
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30393
diff changeset
339 call assert_equal('', &indentexpr)
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30393
diff changeset
340 new
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30393
diff changeset
341 call assert_equal(expand('<SID>') .. 'NewIndentExpr()', &indentexpr)
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30393
diff changeset
342 bw!
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30393
diff changeset
343 setglobal indentexpr=<SID>NewIndentExpr()
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30393
diff changeset
344 call assert_equal(expand('<SID>') .. 'NewIndentExpr()', &g:indentexpr)
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30393
diff changeset
345 call assert_equal('', &indentexpr)
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30393
diff changeset
346 new
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30393
diff changeset
347 call assert_equal(expand('<SID>') .. 'NewIndentExpr()', &indentexpr)
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30393
diff changeset
348 bw!
26743
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26592
diff changeset
349 set indentexpr&
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26592
diff changeset
350
12551
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
351 bw!
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
352 endfunc
a69d3595d773 patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents: 11319
diff changeset
353
20285
bce10d039e06 patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20229
diff changeset
354 " Test changing indent in replace mode
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
355 func Test_edit_12()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
356 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
357 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
358 call cursor(2, 4)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
359 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
360 call assert_equal(["\tabc", "def"], getline(1, '$'))
17857
4935244c1128 patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 16692
diff changeset
361 call assert_equal([0, 2, 2, 0], '.'->getpos())
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
362 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
363 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
364 call cursor(2, 2)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
365 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
366 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
367 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
368 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
369 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
370 call cursor(2, 2)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
371 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
372 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
373 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
374 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
375 10vnew
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
376 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
377 call cursor(2, 2)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
378 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
379 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
380 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
381 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
382 set sw=4
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
383 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
384 call cursor(2, 2)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
385 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
386 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
387 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
388 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
389 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
390 call cursor(2, 2)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
391 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
392 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
393 call assert_equal([0, 2, 2, 0], getpos('.'))
20285
bce10d039e06 patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20229
diff changeset
394 set sw&
bce10d039e06 patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20229
diff changeset
395
bce10d039e06 patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20229
diff changeset
396 " In replace mode, after hitting enter in a line with tab characters,
bce10d039e06 patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20229
diff changeset
397 " pressing backspace should restore the tab characters.
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
398 %d
20285
bce10d039e06 patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20229
diff changeset
399 setlocal autoindent backspace=2
bce10d039e06 patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20229
diff changeset
400 call setline(1, "\tone\t\ttwo")
bce10d039e06 patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20229
diff changeset
401 exe "normal ggRred\<CR>six" .. repeat("\<BS>", 8)
bce10d039e06 patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 20229
diff changeset
402 call assert_equal(["\tone\t\ttwo"], getline(1, '$'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
403 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
404 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
405
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
406 func Test_edit_13()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
407 " Test smartindenting
28942
6cdf55afaae9 patch 8.2.4993: smart/C/lisp indenting is optional
Bram Moolenaar <Bram@vim.org>
parents: 28796
diff changeset
408 new
6cdf55afaae9 patch 8.2.4993: smart/C/lisp indenting is optional
Bram Moolenaar <Bram@vim.org>
parents: 28796
diff changeset
409 set smartindent autoindent
6cdf55afaae9 patch 8.2.4993: smart/C/lisp indenting is optional
Bram Moolenaar <Bram@vim.org>
parents: 28796
diff changeset
410 call setline(1, ["\tabc"])
6cdf55afaae9 patch 8.2.4993: smart/C/lisp indenting is optional
Bram Moolenaar <Bram@vim.org>
parents: 28796
diff changeset
411 call feedkeys("A {\<cr>more\<cr>}\<esc>", 'tnix')
6cdf55afaae9 patch 8.2.4993: smart/C/lisp indenting is optional
Bram Moolenaar <Bram@vim.org>
parents: 28796
diff changeset
412 call assert_equal(["\tabc {", "\t\tmore", "\t}"], getline(1, '$'))
6cdf55afaae9 patch 8.2.4993: smart/C/lisp indenting is optional
Bram Moolenaar <Bram@vim.org>
parents: 28796
diff changeset
413 set smartindent& autoindent&
6cdf55afaae9 patch 8.2.4993: smart/C/lisp indenting is optional
Bram Moolenaar <Bram@vim.org>
parents: 28796
diff changeset
414 bwipe!
16011
de810c9651c8 patch 8.1.1011: indent from autoindent not removed from blank line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
415
de810c9651c8 patch 8.1.1011: indent from autoindent not removed from blank line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
416 " Test autoindent removing indent of blank line.
de810c9651c8 patch 8.1.1011: indent from autoindent not removed from blank line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
417 new
de810c9651c8 patch 8.1.1011: indent from autoindent not removed from blank line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
418 call setline(1, ' foo bar baz')
de810c9651c8 patch 8.1.1011: indent from autoindent not removed from blank line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
419 set autoindent
de810c9651c8 patch 8.1.1011: indent from autoindent not removed from blank line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
420 exe "normal 0eea\<CR>\<CR>\<Esc>"
de810c9651c8 patch 8.1.1011: indent from autoindent not removed from blank line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
421 call assert_equal(" foo bar", getline(1))
de810c9651c8 patch 8.1.1011: indent from autoindent not removed from blank line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
422 call assert_equal("", getline(2))
de810c9651c8 patch 8.1.1011: indent from autoindent not removed from blank line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
423 call assert_equal(" baz", getline(3))
de810c9651c8 patch 8.1.1011: indent from autoindent not removed from blank line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
424 set autoindent&
20941
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
425
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
426 " pressing <C-U> to erase line should keep the indent with 'autoindent'
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
427 set backspace=2 autoindent
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
428 %d
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
429 exe "normal i\tone\<CR>three\<C-U>two"
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
430 call assert_equal(["\tone", "\ttwo"], getline(1, '$'))
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
431 set backspace& autoindent&
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
432
16011
de810c9651c8 patch 8.1.1011: indent from autoindent not removed from blank line
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
433 bwipe!
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
434 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
435
24204
ec71c859e94c patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24164
diff changeset
436 " Test for autoindent removing indent when insert mode is stopped. Some parts
ec71c859e94c patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24164
diff changeset
437 " of the code is exercised only when interactive mode is used. So use Vim in a
ec71c859e94c patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24164
diff changeset
438 " terminal.
ec71c859e94c patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24164
diff changeset
439 func Test_autoindent_remove_indent()
ec71c859e94c patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24164
diff changeset
440 CheckRunVimInTerminal
29997
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29970
diff changeset
441 let buf = RunVimInTerminal('-N Xarifile', {'rows': 6, 'cols' : 20})
24204
ec71c859e94c patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24164
diff changeset
442 call TermWait(buf)
ec71c859e94c patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24164
diff changeset
443 call term_sendkeys(buf, ":set autoindent\n")
ec71c859e94c patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24164
diff changeset
444 " leaving insert mode in a new line with indent added by autoindent, should
ec71c859e94c patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24164
diff changeset
445 " remove the indent.
ec71c859e94c patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24164
diff changeset
446 call term_sendkeys(buf, "i\<Tab>foo\<CR>\<Esc>")
26211
485c7c4afeb7 patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents: 26157
diff changeset
447 " Need to delay for some time, otherwise the code in getchar.c will not be
24204
ec71c859e94c patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24164
diff changeset
448 " exercised.
ec71c859e94c patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24164
diff changeset
449 call TermWait(buf, 50)
ec71c859e94c patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24164
diff changeset
450 " when a line is wrapped and the cursor is at the start of the second line,
ec71c859e94c patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24164
diff changeset
451 " leaving insert mode, should move the cursor back to the first line.
ec71c859e94c patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24164
diff changeset
452 call term_sendkeys(buf, "o" .. repeat('x', 20) .. "\<Esc>")
26211
485c7c4afeb7 patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents: 26157
diff changeset
453 " Need to delay for some time, otherwise the code in getchar.c will not be
24204
ec71c859e94c patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24164
diff changeset
454 " exercised.
ec71c859e94c patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24164
diff changeset
455 call TermWait(buf, 50)
ec71c859e94c patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24164
diff changeset
456 call term_sendkeys(buf, ":w\n")
ec71c859e94c patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24164
diff changeset
457 call TermWait(buf)
ec71c859e94c patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24164
diff changeset
458 call StopVimInTerminal(buf)
29997
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29970
diff changeset
459 call assert_equal(["\tfoo", '', repeat('x', 20)], readfile('Xarifile'))
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29970
diff changeset
460 call delete('Xarifile')
24204
ec71c859e94c patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24164
diff changeset
461 endfunc
ec71c859e94c patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24164
diff changeset
462
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
463 func Test_edit_CR()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
464 " Test for <CR> in insert mode
26211
485c7c4afeb7 patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents: 26157
diff changeset
465 " basically only in quickfix mode it's tested, the rest
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
466 " has been taken care of by other tests
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
467 CheckFeature quickfix
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
468 botright new
30393
409ddc3fa5ce patch 9.0.0532: edit test is flaky when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
469 call writefile(range(1, 10), 'Xqflist.txt', 'D')
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
470 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
471 copen
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
472 set modifiable
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
473 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
474 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
475 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
476 cclose
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
477 botright new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
478 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
479 lopen
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
480 set modifiable
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
481 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
482 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
483 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
484 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
485 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
486 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
487 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
488 call assert_equal(map(range(1, 10), 'string(v:val)') + ['', '', '', ''], getline(1, '$'))
30393
409ddc3fa5ce patch 9.0.0532: edit test is flaky when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
489
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
490 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
491 lclose
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
492 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
493
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
494 func Test_edit_CTRL_()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
495 CheckFeature rightleft
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
496 " disabled for Windows builds, why?
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
497 CheckNotMSWindows
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
498 let _encoding=&encoding
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
499 set encoding=utf-8
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
500 " Test for CTRL-_
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
501 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
502 call setline(1, ['abc'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
503 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
504 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
505 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
506 call assert_false(&revins)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
507 set ari
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
508 call setline(1, ['abc'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
509 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
510 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
511 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
512 call assert_true(&revins)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
513 call setline(1, ['abc'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
514 call cursor(1, 1)
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-_>xyz\<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(["xyzabc"], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
517 call assert_false(&revins)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
518 set noari
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
519 let &encoding=_encoding
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
520 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
521 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
522
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
523 " needs to come first, to have the @. register empty
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
524 func Test_edit_00a_CTRL_A()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
525 " Test pressing CTRL-A
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
526 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
527 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
528 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
529 try
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
530 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
531 catch /^Vim\%((\a\+)\)\=:E29/
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
532 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
533 endtry
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
534 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
535 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
536 call cursor(2, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
537 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
538 call cursor(3, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
539 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
540 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
541 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
542 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
543
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
544 func Test_edit_CTRL_EY()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
545 " 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
546 10new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
547 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
548 call cursor(30, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
549 norm! z.
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
550 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
551 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
552 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
553 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
554 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
555 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
556 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
557 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
558 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
559
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
560 func Test_edit_CTRL_G()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
561 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
562 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
563 call cursor(2, 4)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
564 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
565 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
566 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
567 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
568 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
569 call cursor(2, 4)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
570 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
571 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
572 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
573 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
574 call assert_equal([0, 3, 6, 0], getpos('.'))
32049
717a1a8dc751 patch 9.0.1356: cannot cancel "gr" with Esc
Bram Moolenaar <Bram@vim.org>
parents: 32045
diff changeset
575 call assert_nobeep("normal! i\<c-g>\<esc>")
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
576 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
577 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
578
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
579 func Test_edit_CTRL_I()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
580 " Tab in completion mode
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
581 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
582 new
14039
acb2dc112b06 patch 8.1.0037: cannot easily append lines to another buffer
Christian Brabandt <cb@256bit.org>
parents: 14033
diff changeset
583 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
584 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
585 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
586 %d
30393
409ddc3fa5ce patch 9.0.0532: edit test is flaky when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
587 call writefile(['one', 'two', 'three'], 'Xinclude.txt', 'D')
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
588 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
589 call setline(1, [include, ''])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
590 call cursor(2, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
591 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
592 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
593 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
594 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
595 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
596 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
597 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
598 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
599 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
600 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
601
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
602 func Test_edit_CTRL_K()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
603 " 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
604 " the rest is already covered
30393
409ddc3fa5ce patch 9.0.0532: edit test is flaky when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
605 call writefile(['A', 'AA', 'AAA', 'AAAA'], 'Xdictionary.txt', 'D')
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
606 set dictionary=Xdictionary.txt
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
607 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
608 call setline(1, 'A')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
609 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
610 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
611 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
612 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
613 call setline(1, 'A')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
614 call cursor(1, 1)
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-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
616 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
617 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
618 call setline(1, 'A')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
619 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
620 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
621 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
622 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
623 call setline(1, 'A')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
624 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
625 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
626 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
627 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
628 call setline(1, 'A')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
629 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
630 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
631 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
632
19195
2ef19eed524a patch 8.2.0156: various typos in source files and tests
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
633 " press an unexpected key after dictionary completion
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
634 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
635 call setline(1, 'A')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
636 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
637 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
638 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
639 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
640 call setline(1, 'A')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
641 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
642 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
643 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
644 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
645 call setline(1, 'A')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
646 call cursor(1, 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-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
648 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
649
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
650 set dictionary=
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
651 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
652 call setline(1, 'A')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
653 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
654 let v:testing = 1
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
655 try
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
656 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
657 catch
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
658 " 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
659 let v:testing = 0
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
660 endtry
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
661
15607
2dcaa860e3fc patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
662 call test_override("char_avail", 1)
2dcaa860e3fc patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
663 set showcmd
2dcaa860e3fc patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
664 %d
2dcaa860e3fc patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
665 call feedkeys("A\<c-k>a:\<esc>", 'tnix')
2dcaa860e3fc patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
666 call assert_equal(['ä'], getline(1, '$'))
2dcaa860e3fc patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
667 call test_override("char_avail", 0)
2dcaa860e3fc patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
668 set noshowcmd
2dcaa860e3fc patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
669
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
670 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
671 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
672
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
673 func Test_edit_CTRL_L()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
674 " 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
675 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
676 set complete=.
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
677 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
678 call cursor(4, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
679 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
680 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
681 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
682 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
683 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
684 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
685 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
686 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
687 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
688 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
689 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
690 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
691 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
692 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
693 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
694 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
695 set complete=
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
696 call cursor(5, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
697 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
698 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
699 set complete&
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
700 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
701 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
702 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
703 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
704 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
705 syn on
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
706 syn match ErrorMsg "^bar"
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
707 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
708 func! DoIt()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
709 let g:change=1
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
710 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
711 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
712
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
713 call cursor(2, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
714 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
715 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
716 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
717 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
718
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
719 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
720 call clearmatches()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
721 syn off
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
722 au! TextChangedI
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
723 delfu DoIt
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
724 unlet! g:change
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
725 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
726 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
727 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
728
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
729 func Test_edit_CTRL_N()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
730 " Check keyword completion
23984
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 22724
diff changeset
731 for e in ['latin1', 'utf-8']
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 22724
diff changeset
732 exe 'set encoding=' .. e
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 22724
diff changeset
733 new
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 22724
diff changeset
734 set complete=.
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 22724
diff changeset
735 call setline(1, ['INFER', 'loWER', '', '', ])
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 22724
diff changeset
736 call cursor(3, 1)
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 22724
diff changeset
737 call feedkeys("Ai\<c-n>\<cr>\<esc>", "tnix")
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 22724
diff changeset
738 call feedkeys("ILO\<c-n>\<cr>\<esc>", 'tnix')
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 22724
diff changeset
739 call assert_equal(['INFER', 'loWER', 'i', 'LO', '', ''], getline(1, '$'), e)
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 22724
diff changeset
740 %d
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 22724
diff changeset
741 call setline(1, ['INFER', 'loWER', '', '', ])
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 22724
diff changeset
742 call cursor(3, 1)
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 22724
diff changeset
743 set ignorecase infercase
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 22724
diff changeset
744 call feedkeys("Ii\<c-n>\<cr>\<esc>", "tnix")
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 22724
diff changeset
745 call feedkeys("ILO\<c-n>\<cr>\<esc>", 'tnix')
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 22724
diff changeset
746 call assert_equal(['INFER', 'loWER', 'infer', 'LOWER', '', ''], getline(1, '$'), e)
26921
b975b7c16ba1 patch 8.2.3989: some insert completion code is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
747 set noignorecase noinfercase
b975b7c16ba1 patch 8.2.3989: some insert completion code is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
748 %d
b975b7c16ba1 patch 8.2.3989: some insert completion code is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
749 call setline(1, ['one word', 'two word'])
b975b7c16ba1 patch 8.2.3989: some insert completion code is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
750 exe "normal! Goo\<C-P>\<C-X>\<C-P>"
b975b7c16ba1 patch 8.2.3989: some insert completion code is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
751 call assert_equal('one word', getline(3))
b975b7c16ba1 patch 8.2.3989: some insert completion code is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
752 %d
b975b7c16ba1 patch 8.2.3989: some insert completion code is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
753 set complete&
23984
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 22724
diff changeset
754 bw!
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 22724
diff changeset
755 endfor
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
756 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
757
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
758 func Test_edit_CTRL_O()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
759 " 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
760 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
761 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
762 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
763 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
764 " 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
765 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
766 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
767 call assert_true(&nu)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
768 set nonu
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
769 iunabbr <buffer> h
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
770 " 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
771 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
772 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
773 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
774 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
775 set ve=onemore
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
776 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
777 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
778 set ve=
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
779 unlet! g:a
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
780 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
781 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
782
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
783 func Test_edit_CTRL_R()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
784 " Insert Register
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
785 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
786 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
787 set showcmd
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
788 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
789 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
790 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
791 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
792 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
793 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
794 set noshowcmd
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
795 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
796 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
797
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
798 func Test_edit_CTRL_S()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
799 " 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
800 " 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
801 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
802 if !has("spell")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
803 call setline(1, 'vim')
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>ss\<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(['vims', ''], getline(1, '$'))
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
806 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
807 return
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
808 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
809 call setline(1, 'vim')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
810 " 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
811 try
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
812 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
813 catch /^Vim\%((\a\+)\)\=:E756/
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
814 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
815 endtry
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
816 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
817 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
818 setl spell spelllang=en
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
819 call setline(1, 'vim')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
820 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
821 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
822 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
823 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
824 call setline(1, 'vim')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
825 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
826 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
827 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
828 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
829 call setline(1, 'vim')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
830 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
831 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
832 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
833 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
834 " empty buffer
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-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
837 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
838 setl nospell
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
839 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
840 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
841
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
842 func Test_edit_CTRL_T()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
843 " 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
844 " 1) increase indent
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
845 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
846 call setline(1, "abc")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
847 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
848 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
849 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
850 " 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
851 set paste
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
852 call setline(1, "abc")
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
853 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
854 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
855 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
856 set nopaste
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
857 " CTRL-X CTRL-T (thesaurus complete)
30393
409ddc3fa5ce patch 9.0.0532: edit test is flaky when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
858 call writefile(['angry furious mad enraged'], 'Xthesaurus', 'D')
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
859 set thesaurus=Xthesaurus
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
860 call setline(1, 'mad')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
861 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
862 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
863 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
864 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
865 call setline(1, 'mad')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
866 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
867 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
868 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
869 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
870 call setline(1, 'mad')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
871 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
872 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
873 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
874 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
875 call setline(1, 'mad')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
876 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
877 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
878 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
879 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
880 call setline(1, 'mad')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
881 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
882 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
883 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
884 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
885 call setline(1, 'mad')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
886 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
887 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
888 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
889 " 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
890 set complete=
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
891 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
892 call setline(1, 'mad')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
893 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
894 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
895 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
896 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
897 call setline(1, 'mad')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
898 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
899 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
900 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
901 set complete&
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
902
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
903 set thesaurus=
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
904 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
905 call setline(1, 'mad')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
906 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
907 let v:testing = 1
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
908 try
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
909 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
910 catch
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
911 " 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
912 let v:testing = 0
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
913 endtry
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
914 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
915 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
916 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
917
26921
b975b7c16ba1 patch 8.2.3989: some insert completion code is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
918 " Test thesaurus completion with different encodings
b975b7c16ba1 patch 8.2.3989: some insert completion code is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
919 func Test_thesaurus_complete_with_encoding()
30393
409ddc3fa5ce patch 9.0.0532: edit test is flaky when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
920 call writefile(['angry furious mad enraged'], 'Xthesaurus', 'D')
26921
b975b7c16ba1 patch 8.2.3989: some insert completion code is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
921 set thesaurus=Xthesaurus
b975b7c16ba1 patch 8.2.3989: some insert completion code is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
922 for e in ['latin1', 'utf-8']
b975b7c16ba1 patch 8.2.3989: some insert completion code is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
923 exe 'set encoding=' .. e
b975b7c16ba1 patch 8.2.3989: some insert completion code is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
924 new
b975b7c16ba1 patch 8.2.3989: some insert completion code is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
925 call setline(1, 'mad')
b975b7c16ba1 patch 8.2.3989: some insert completion code is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
926 call cursor(1, 1)
b975b7c16ba1 patch 8.2.3989: some insert completion code is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
927 call feedkeys("A\<c-x>\<c-t>\<cr>\<esc>", 'tnix')
b975b7c16ba1 patch 8.2.3989: some insert completion code is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
928 call assert_equal(['mad', ''], getline(1, '$'))
b975b7c16ba1 patch 8.2.3989: some insert completion code is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
929 bw!
b975b7c16ba1 patch 8.2.3989: some insert completion code is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
930 endfor
b975b7c16ba1 patch 8.2.3989: some insert completion code is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
931 set thesaurus=
b975b7c16ba1 patch 8.2.3989: some insert completion code is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
932 endfunc
b975b7c16ba1 patch 8.2.3989: some insert completion code is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
933
25974
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
934 " Test 'thesaurusfunc'
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
935 func MyThesaurus(findstart, base)
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
936 let mythesaurus = [
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
937 \ #{word: "happy",
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
938 \ synonyms: "cheerful,blissful,flying high,looking good,peppy"},
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
939 \ #{word: "kind",
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
940 \ synonyms: "amiable,bleeding-heart,heart in right place"}]
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
941 if a:findstart
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
942 " locate the start of the word
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
943 let line = getline('.')
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
944 let start = col('.') - 1
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
945 while start > 0 && line[start - 1] =~ '\a'
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
946 let start -= 1
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
947 endwhile
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
948 return start
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
949 else
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
950 " find strings matching with "a:base"
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
951 let res = []
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
952 for w in mythesaurus
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
953 if w.word =~ '^' . a:base
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
954 call add(res, w.word)
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
955 call extend(res, split(w.synonyms, ","))
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
956 endif
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
957 endfor
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
958 return res
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
959 endif
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
960 endfunc
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
961
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
962 func Test_thesaurus_func()
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
963 new
25990
ac330e2fecc4 patch 8.2.3528: 'thesaurus' and 'thesaurusfunc' do not have the same scope
Bram Moolenaar <Bram@vim.org>
parents: 25974
diff changeset
964 set thesaurus=notused
ac330e2fecc4 patch 8.2.3528: 'thesaurus' and 'thesaurusfunc' do not have the same scope
Bram Moolenaar <Bram@vim.org>
parents: 25974
diff changeset
965 set thesaurusfunc=NotUsed
ac330e2fecc4 patch 8.2.3528: 'thesaurus' and 'thesaurusfunc' do not have the same scope
Bram Moolenaar <Bram@vim.org>
parents: 25974
diff changeset
966 setlocal thesaurusfunc=MyThesaurus
25974
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
967 call setline(1, "an ki")
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
968 call cursor(1, 1)
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
969 call feedkeys("A\<c-x>\<c-t>\<c-n>\<cr>\<esc>", 'tnix')
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
970 call assert_equal(['an amiable', ''], getline(1, '$'))
25990
ac330e2fecc4 patch 8.2.3528: 'thesaurus' and 'thesaurusfunc' do not have the same scope
Bram Moolenaar <Bram@vim.org>
parents: 25974
diff changeset
971
ac330e2fecc4 patch 8.2.3528: 'thesaurus' and 'thesaurusfunc' do not have the same scope
Bram Moolenaar <Bram@vim.org>
parents: 25974
diff changeset
972 setlocal thesaurusfunc=NonExistingFunc
ac330e2fecc4 patch 8.2.3528: 'thesaurus' and 'thesaurusfunc' do not have the same scope
Bram Moolenaar <Bram@vim.org>
parents: 25974
diff changeset
973 call assert_fails("normal $a\<C-X>\<C-T>", 'E117:')
ac330e2fecc4 patch 8.2.3528: 'thesaurus' and 'thesaurusfunc' do not have the same scope
Bram Moolenaar <Bram@vim.org>
parents: 25974
diff changeset
974
ac330e2fecc4 patch 8.2.3528: 'thesaurus' and 'thesaurusfunc' do not have the same scope
Bram Moolenaar <Bram@vim.org>
parents: 25974
diff changeset
975 setlocal thesaurusfunc=
25974
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
976 set thesaurusfunc=NonExistingFunc
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
977 call assert_fails("normal $a\<C-X>\<C-T>", 'E117:')
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
978 %bw!
25990
ac330e2fecc4 patch 8.2.3528: 'thesaurus' and 'thesaurusfunc' do not have the same scope
Bram Moolenaar <Bram@vim.org>
parents: 25974
diff changeset
979
ac330e2fecc4 patch 8.2.3528: 'thesaurus' and 'thesaurusfunc' do not have the same scope
Bram Moolenaar <Bram@vim.org>
parents: 25974
diff changeset
980 set thesaurusfunc=
ac330e2fecc4 patch 8.2.3528: 'thesaurus' and 'thesaurusfunc' do not have the same scope
Bram Moolenaar <Bram@vim.org>
parents: 25974
diff changeset
981 set thesaurus=
25974
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
982 endfunc
416237f1de22 patch 8.2.3520: cannot define a function for thesaurus completion
Bram Moolenaar <Bram@vim.org>
parents: 25858
diff changeset
983
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
984 func Test_edit_CTRL_U()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
985 " Test 'completefunc'
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
986 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
987 " -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
988 let g:special=0
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
989 fun! CompleteMonths(findstart, base)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
990 if a:findstart
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
991 " 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
992 return g:special
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
993 else
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
994 " 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
995 let res = []
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
996 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
997 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
998 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
999 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1000 endfor
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1001 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
1002 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1003 endfun
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1004 set completefunc=CompleteMonths
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1005 call setline(1, ['', ''])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1006 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1007 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
1008 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
1009 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1010 let g:special=-1
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1011 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
1012 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
1013 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1014 let g:special=-2
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1015 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
1016 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
1017 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1018 let g:special=-3
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1019 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
1020 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
1021 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1022 let g:special=0
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1023 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
1024 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
1025 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1026 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
1027 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
1028 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1029 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
1030 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
1031 delfu CompleteMonths
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1032 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1033 try
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1034 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
1035 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
1036 catch /^Vim\%((\a\+)\)\=:E117/
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1037 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
1038 endtry
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1039 set completefunc=
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1040 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1041 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1042
20118
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19852
diff changeset
1043 func Test_edit_completefunc_delete()
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19852
diff changeset
1044 func CompleteFunc(findstart, base)
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19852
diff changeset
1045 if a:findstart == 1
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19852
diff changeset
1046 return col('.') - 1
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19852
diff changeset
1047 endif
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19852
diff changeset
1048 normal dd
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19852
diff changeset
1049 return ['a', 'b']
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19852
diff changeset
1050 endfunc
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19852
diff changeset
1051 new
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19852
diff changeset
1052 set completefunc=CompleteFunc
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19852
diff changeset
1053 call setline(1, ['', 'abcd', ''])
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19852
diff changeset
1054 2d
29014
45c182c4f7e9 patch 8.2.5029: "textlock" is always zero
Bram Moolenaar <Bram@vim.org>
parents: 28942
diff changeset
1055 call assert_fails("normal 2G$a\<C-X>\<C-U>", 'E565:')
20118
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19852
diff changeset
1056 bwipe!
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19852
diff changeset
1057 endfunc
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19852
diff changeset
1058
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19852
diff changeset
1059
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
1060 func Test_edit_CTRL_Z()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1061 " 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
1062 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1063 call setline(1, 'abc')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1064 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
1065 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
1066 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1067 " 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
1068 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1069
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
1070 func Test_edit_DROP()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1071 CheckFeature dnd
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1072 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1073 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
1074 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1075 try
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1076 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
1077 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
1078 catch /^Vim\%((\a\+)\)\=:E353/
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1079 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
1080 endtry
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1081 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1082 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1083
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
1084 func Test_edit_CTRL_V()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1085 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1086 call setline(1, ['abc'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1087 call cursor(2, 1)
27350
63179e8300f8 patch 8.2.4203: entering a character with CTRL-V may include modifiers
Bram Moolenaar <Bram@vim.org>
parents: 27090
diff changeset
1088
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1089 " force some redraws
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1090 set showmode showcmd
27350
63179e8300f8 patch 8.2.4203: entering a character with CTRL-V may include modifiers
Bram Moolenaar <Bram@vim.org>
parents: 27090
diff changeset
1091 call test_override('char_avail', 1)
63179e8300f8 patch 8.2.4203: entering a character with CTRL-V may include modifiers
Bram Moolenaar <Bram@vim.org>
parents: 27090
diff changeset
1092
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1093 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
1094 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
1095
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1096 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
1097 set rl
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1098 call setline(1, ['abc'])
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1099 call cursor(2, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1100 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
1101 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
1102 set norl
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1103 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1104
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1105 set noshowmode showcmd
27350
63179e8300f8 patch 8.2.4203: entering a character with CTRL-V may include modifiers
Bram Moolenaar <Bram@vim.org>
parents: 27090
diff changeset
1106 call test_override('char_avail', 0)
63179e8300f8 patch 8.2.4203: entering a character with CTRL-V may include modifiers
Bram Moolenaar <Bram@vim.org>
parents: 27090
diff changeset
1107
63179e8300f8 patch 8.2.4203: entering a character with CTRL-V may include modifiers
Bram Moolenaar <Bram@vim.org>
parents: 27090
diff changeset
1108 " No modifiers should be applied to the char typed using i_CTRL-V_digit.
63179e8300f8 patch 8.2.4203: entering a character with CTRL-V may include modifiers
Bram Moolenaar <Bram@vim.org>
parents: 27090
diff changeset
1109 call feedkeys(":append\<CR>\<C-V>76c\<C-V>76\<C-F2>\<C-V>u3c0j\<C-V>u3c0\<M-F3>\<CR>.\<CR>", 'tnix')
63179e8300f8 patch 8.2.4203: entering a character with CTRL-V may include modifiers
Bram Moolenaar <Bram@vim.org>
parents: 27090
diff changeset
1110 call assert_equal('LcL<C-F2>πjπ<M-F3>', getline(2))
63179e8300f8 patch 8.2.4203: entering a character with CTRL-V may include modifiers
Bram Moolenaar <Bram@vim.org>
parents: 27090
diff changeset
1111
63179e8300f8 patch 8.2.4203: entering a character with CTRL-V may include modifiers
Bram Moolenaar <Bram@vim.org>
parents: 27090
diff changeset
1112 if has('osx')
63179e8300f8 patch 8.2.4203: entering a character with CTRL-V may include modifiers
Bram Moolenaar <Bram@vim.org>
parents: 27090
diff changeset
1113 " A char with a modifier should not be a valid char for i_CTRL-V_digit.
63179e8300f8 patch 8.2.4203: entering a character with CTRL-V may include modifiers
Bram Moolenaar <Bram@vim.org>
parents: 27090
diff changeset
1114 call feedkeys("o\<C-V>\<D-j>\<C-V>\<D-1>\<C-V>\<D-o>\<C-V>\<D-x>\<C-V>\<D-u>", 'tnix')
63179e8300f8 patch 8.2.4203: entering a character with CTRL-V may include modifiers
Bram Moolenaar <Bram@vim.org>
parents: 27090
diff changeset
1115 call assert_equal('<D-j><D-1><D-o><D-x><D-u>', getline(3))
63179e8300f8 patch 8.2.4203: entering a character with CTRL-V may include modifiers
Bram Moolenaar <Bram@vim.org>
parents: 27090
diff changeset
1116 endif
63179e8300f8 patch 8.2.4203: entering a character with CTRL-V may include modifiers
Bram Moolenaar <Bram@vim.org>
parents: 27090
diff changeset
1117
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1118 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1119 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1120
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
1121 func Test_edit_F1()
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18538
diff changeset
1122 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18538
diff changeset
1123
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1124 " Pressing <f1>
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1125 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1126 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
1127 set noinsertmode
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1128 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
1129 bw
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1130 bw
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1131 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1132
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
1133 func Test_edit_F21()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1134 " Pressing <f21>
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1135 " sends a netbeans command
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1136 CheckFeature netbeans_intg
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1137 new
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1138 " I have no idea what this is supposed to do :)
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1139 call feedkeys("A\<F21>\<F1>\<esc>", 'tnix')
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1140 bw
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1141 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1142
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
1143 func Test_edit_HOME_END()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1144 " Test Home/End Keys
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1145 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1146 set foldopen+=hor
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1147 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
1148 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1149 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
1150 call cursor(2, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1151 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
1152 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
1153
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1154 set foldopen-=hor
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1155 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1156 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1157
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
1158 func Test_edit_INS()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1159 " Test for Pressing <Insert>
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1160 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1161 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
1162 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1163 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
1164 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
1165 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
1166 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1167 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
1168 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
1169 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1170 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1171
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
1172 func Test_edit_LEFT_RIGHT()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1173 " 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
1174 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1175 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
1176 let _ww=&ww
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1177 set ww=
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1178 call cursor(2, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1179 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
1180 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
1181 " 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
1182 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
1183 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
1184 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
1185 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
1186 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
1187 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
1188 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
1189 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
1190 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
1191 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
1192 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
1193 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
1194 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
1195 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
1196 call cursor(3, 11)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1197 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
1198 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
1199 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
1200 call cursor(2, 11)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1201 " <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
1202 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
1203 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
1204 " 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
1205 set ww+=[,]
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1206 call cursor(2, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1207 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
1208 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
1209 call cursor(2, 11)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1210 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
1211 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
1212 call cursor(2, 11)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1213 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
1214 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
1215 let &ww = _ww
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1216 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1217 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1218
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
1219 func Test_edit_MOUSE()
33223
def9fc5c92d1 patch 9.0.1886: Various Typos
Christian Brabandt <cb@256bit.org>
parents: 32194
diff changeset
1220 " This is a simple test, since we're not really using the mouse here
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1221 CheckFeature mouse
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1222 10new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1223 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
1224 call cursor(1, 1)
28784
faf3acb2509b patch 8.2.4916: mouse in Insert mode test fails
Bram Moolenaar <Bram@vim.org>
parents: 28704
diff changeset
1225 call assert_equal(1, line('w0'))
faf3acb2509b patch 8.2.4916: mouse in Insert mode test fails
Bram Moolenaar <Bram@vim.org>
parents: 28704
diff changeset
1226 call assert_equal(10, line('w$'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1227 set mouse=a
28784
faf3acb2509b patch 8.2.4916: mouse in Insert mode test fails
Bram Moolenaar <Bram@vim.org>
parents: 28704
diff changeset
1228 " One scroll event moves three lines.
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1229 call feedkeys("A\<ScrollWheelDown>\<esc>", 'tnix')
28784
faf3acb2509b patch 8.2.4916: mouse in Insert mode test fails
Bram Moolenaar <Bram@vim.org>
parents: 28704
diff changeset
1230 call assert_equal(4, line('w0'))
faf3acb2509b patch 8.2.4916: mouse in Insert mode test fails
Bram Moolenaar <Bram@vim.org>
parents: 28704
diff changeset
1231 call assert_equal(13, line('w$'))
faf3acb2509b patch 8.2.4916: mouse in Insert mode test fails
Bram Moolenaar <Bram@vim.org>
parents: 28704
diff changeset
1232 " This should move by one page down.
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1233 call feedkeys("A\<S-ScrollWheelDown>\<esc>", 'tnix')
28784
faf3acb2509b patch 8.2.4916: mouse in Insert mode test fails
Bram Moolenaar <Bram@vim.org>
parents: 28704
diff changeset
1234 call assert_equal(14, line('w0'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1235 set nostartofline
28784
faf3acb2509b patch 8.2.4916: mouse in Insert mode test fails
Bram Moolenaar <Bram@vim.org>
parents: 28704
diff changeset
1236 " Another page down.
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1237 call feedkeys("A\<C-ScrollWheelDown>\<esc>", 'tnix')
28784
faf3acb2509b patch 8.2.4916: mouse in Insert mode test fails
Bram Moolenaar <Bram@vim.org>
parents: 28704
diff changeset
1238 call assert_equal(24, line('w0'))
faf3acb2509b patch 8.2.4916: mouse in Insert mode test fails
Bram Moolenaar <Bram@vim.org>
parents: 28704
diff changeset
1239
faf3acb2509b patch 8.2.4916: mouse in Insert mode test fails
Bram Moolenaar <Bram@vim.org>
parents: 28704
diff changeset
1240 call assert_equal([0, 24, 2, 0], getpos('.'))
faf3acb2509b patch 8.2.4916: mouse in Insert mode test fails
Bram Moolenaar <Bram@vim.org>
parents: 28704
diff changeset
1241 call test_setmouse(4, 3)
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1242 call feedkeys("A\<LeftMouse>\<esc>", 'tnix')
28784
faf3acb2509b patch 8.2.4916: mouse in Insert mode test fails
Bram Moolenaar <Bram@vim.org>
parents: 28704
diff changeset
1243 call assert_equal([0, 27, 2, 0], getpos('.'))
28796
7c1a884495e5 patch 8.2.4922: mouse test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 28784
diff changeset
1244 set mousemodel=extend
28784
faf3acb2509b patch 8.2.4916: mouse in Insert mode test fails
Bram Moolenaar <Bram@vim.org>
parents: 28704
diff changeset
1245 call test_setmouse(5, 3)
faf3acb2509b patch 8.2.4916: mouse in Insert mode test fails
Bram Moolenaar <Bram@vim.org>
parents: 28704
diff changeset
1246 call feedkeys("A\<RightMouse>\<esc>\<esc>", 'tnix')
faf3acb2509b patch 8.2.4916: mouse in Insert mode test fails
Bram Moolenaar <Bram@vim.org>
parents: 28704
diff changeset
1247 call assert_equal([0, 28, 2, 0], getpos('.'))
28796
7c1a884495e5 patch 8.2.4922: mouse test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 28784
diff changeset
1248 set mousemodel&
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1249 call cursor(1, 100)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1250 norm! zt
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1251 " 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
1252 " 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
1253 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
1254 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
1255 call cursor(1, 30)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1256 norm! zt
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1257 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
1258 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
1259 call cursor(1, 30)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1260 norm! zt
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1261 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
1262 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
1263 %d
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1264 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
1265 call cursor(2, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1266 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
1267 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
1268 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
1269 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
1270 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
1271 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
1272 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
1273 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
1274 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
1275 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
1276 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
1277 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
1278 set mouse& startofline
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1279 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1280 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1281
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
1282 func Test_edit_PAGEUP_PAGEDOWN()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1283 10new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1284 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
1285 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1286 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
1287 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
1288 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
1289 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
1290 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
1291 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
1292 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
1293 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
1294 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
1295 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
1296 call feedkeys("A\<PageUp>\<esc>", 'tnix')
34665
ca2da8e8fb53 patch 9.1.0215: Half-page scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34653
diff changeset
1297 call assert_equal([0, 29, 1, 0], getpos('.'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1298 call feedkeys("A\<PageUp>\<esc>", 'tnix')
34665
ca2da8e8fb53 patch 9.1.0215: Half-page scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34653
diff changeset
1299 call assert_equal([0, 21, 1, 0], getpos('.'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1300 call feedkeys("A\<PageUp>\<esc>", 'tnix')
34665
ca2da8e8fb53 patch 9.1.0215: Half-page scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34653
diff changeset
1301 call assert_equal([0, 13, 1, 0], getpos('.'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1302 call feedkeys("A\<PageUp>\<esc>", 'tnix')
34653
8079960136db patch 9.1.0211: page-wise scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34636
diff changeset
1303 call assert_equal([0, 10, 1, 0], getpos('.'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1304 call feedkeys("A\<PageUp>\<esc>", 'tnix')
34761
b20609f4ab37 patch 9.1.0258: half-page scrolling broke backward compatibility
Christian Brabandt <cb@256bit.org>
parents: 34674
diff changeset
1305 call assert_equal([0, 10, 11, 0], getpos('.'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1306 " <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
1307 " <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
1308 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1309 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
1310 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
1311 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
1312 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
1313 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
1314 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
1315 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
1316 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
1317 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
1318 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
1319 call feedkeys("A\<S-Up>\<esc>", 'tnix')
34665
ca2da8e8fb53 patch 9.1.0215: Half-page scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34653
diff changeset
1320 call assert_equal([0, 29, 1, 0], getpos('.'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1321 call feedkeys("A\<S-Up>\<esc>", 'tnix')
34665
ca2da8e8fb53 patch 9.1.0215: Half-page scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34653
diff changeset
1322 call assert_equal([0, 21, 1, 0], getpos('.'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1323 call feedkeys("A\<S-Up>\<esc>", 'tnix')
34665
ca2da8e8fb53 patch 9.1.0215: Half-page scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34653
diff changeset
1324 call assert_equal([0, 13, 1, 0], getpos('.'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1325 call feedkeys("A\<S-Up>\<esc>", 'tnix')
34653
8079960136db patch 9.1.0211: page-wise scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34636
diff changeset
1326 call assert_equal([0, 10, 1, 0], getpos('.'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1327 call feedkeys("A\<S-Up>\<esc>", 'tnix')
34761
b20609f4ab37 patch 9.1.0258: half-page scrolling broke backward compatibility
Christian Brabandt <cb@256bit.org>
parents: 34674
diff changeset
1328 call assert_equal([0, 10, 11, 0], getpos('.'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1329 set nostartofline
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1330 call cursor(30, 11)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1331 norm! zt
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1332 call feedkeys("A\<PageUp>\<esc>", 'tnix')
34665
ca2da8e8fb53 patch 9.1.0215: Half-page scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34653
diff changeset
1333 call assert_equal([0, 29, 11, 0], getpos('.'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1334 call feedkeys("A\<PageUp>\<esc>", 'tnix')
34665
ca2da8e8fb53 patch 9.1.0215: Half-page scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34653
diff changeset
1335 call assert_equal([0, 21, 11, 0], getpos('.'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1336 call feedkeys("A\<PageUp>\<esc>", 'tnix')
34665
ca2da8e8fb53 patch 9.1.0215: Half-page scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34653
diff changeset
1337 call assert_equal([0, 13, 11, 0], getpos('.'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1338 call feedkeys("A\<PageUp>\<esc>", 'tnix')
34653
8079960136db patch 9.1.0211: page-wise scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34636
diff changeset
1339 call assert_equal([0, 10, 11, 0], getpos('.'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1340 call feedkeys("A\<PageUp>\<esc>", 'tnix')
34761
b20609f4ab37 patch 9.1.0258: half-page scrolling broke backward compatibility
Christian Brabandt <cb@256bit.org>
parents: 34674
diff changeset
1341 call assert_equal([0, 10, 11, 0], getpos('.'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1342 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1343 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
1344 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
1345 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
1346 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
1347 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
1348 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
1349 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
1350 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
1351 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
1352 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
1353 " <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
1354 " <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
1355 call cursor(30, 11)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1356 norm! zt
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1357 call feedkeys("A\<S-Up>\<esc>", 'tnix')
34665
ca2da8e8fb53 patch 9.1.0215: Half-page scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34653
diff changeset
1358 call assert_equal([0, 29, 11, 0], getpos('.'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1359 call feedkeys("A\<S-Up>\<esc>", 'tnix')
34665
ca2da8e8fb53 patch 9.1.0215: Half-page scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34653
diff changeset
1360 call assert_equal([0, 21, 11, 0], getpos('.'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1361 call feedkeys("A\<S-Up>\<esc>", 'tnix')
34665
ca2da8e8fb53 patch 9.1.0215: Half-page scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34653
diff changeset
1362 call assert_equal([0, 13, 11, 0], getpos('.'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1363 call feedkeys("A\<S-Up>\<esc>", 'tnix')
34653
8079960136db patch 9.1.0211: page-wise scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34636
diff changeset
1364 call assert_equal([0, 10, 11, 0], getpos('.'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1365 call feedkeys("A\<S-Up>\<esc>", 'tnix')
34761
b20609f4ab37 patch 9.1.0258: half-page scrolling broke backward compatibility
Christian Brabandt <cb@256bit.org>
parents: 34674
diff changeset
1366 call assert_equal([0, 10, 11, 0], getpos('.'))
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1367 call cursor(1, 1)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1368 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
1369 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
1370 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
1371 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
1372 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
1373 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
1374 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
1375 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
1376 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
1377 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
1378 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1379 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1380
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
1381 func Test_edit_forbidden()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1382 new
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1383 " 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
1384 call setline(1, 'a')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1385 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
1386 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
1387 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
1388 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
1389 delcom Sandbox
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1390 call assert_equal(['a'], getline(1,'$'))
26592
9f445e07f766 patch 8.2.3825: various comments could be improved
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1391
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1392 " 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
1393 fu! DoIt()
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1394 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
1395 endfu
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1396 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
1397 try
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1398 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
1399 call assert_fails(1, 'textlock')
20118
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19852
diff changeset
1400 catch /^Vim\%((\a\+)\)\=:E565/ " catch E565: not allowed here
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1401 endtry
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1402 " 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
1403 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
1404 delfu DoIt
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1405 try
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1406 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
1407 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
1408 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
1409 endtry
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1410 au! InsertCharPre
26592
9f445e07f766 patch 8.2.3825: various comments could be improved
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1411
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1412 " 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
1413 fun! Complete(findstart, base)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1414 if a:findstart
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1415 return col('.')
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1416 else
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1417 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
1418 return []
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1419 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1420 endfun
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1421 set completefunc=Complete
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1422 try
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1423 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
1424 call assert_fails(1, 'change in complete function')
20118
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19852
diff changeset
1425 catch /^Vim\%((\a\+)\)\=:E565/ " catch E565
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1426 endtry
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1427 delfu Complete
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1428 set completefunc=
26592
9f445e07f766 patch 8.2.3825: various comments could be improved
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1429
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1430 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
1431 " 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
1432 set revins fkmap
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1433 try
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1434 normal Ri
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1435 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
1436 catch
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1437 finally
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1438 set norevins nofkmap
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1439 endtry
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1440 endif
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1441 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1442 endfunc
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1443
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14985
diff changeset
1444 func Test_edit_rightleft()
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1445 " Cursor in rightleft mode moves differently
20941
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1446 CheckFeature rightleft
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1447 call NewWindow(10, 20)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1448 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
1449 call cursor(1, 2)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1450 set rightleft
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1451 " Screen looks as expected
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1452 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
1453 let expect = [
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1454 \" cba",
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1455 \" fed",
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1456 \" ihg",
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1457 \" ~"]
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1458 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
1459 " 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
1460 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
1461 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
1462 call cursor(1, 2)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1463 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
1464 call cursor(1, 2)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1465 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
1466 " Screen looks as expected
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1467 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
1468 let expect = [
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1469 \" cb",
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1470 \" fed",
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1471 \" ihg",
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1472 \" ~"]
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1473 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
1474 " 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
1475 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
1476 call cursor(1, 2)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1477 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
1478 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
1479 call cursor(1, 2)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1480 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
1481 call cursor(1, 2)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1482 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
1483 " Screen looks as expected
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1484 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
1485 let expect = [
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1486 \" ca",
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1487 \" fed",
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1488 \" ihg",
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1489 \" ~"]
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1490 call assert_equal(join(expect, "\n"), join(lines, "\n"))
20941
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1491 %d _
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1492 call test_override('redraw_flag', 1)
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1493 call test_override('char_avail', 1)
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1494 call feedkeys("a\<C-V>x41", "xt")
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1495 redraw!
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1496 call assert_equal(repeat(' ', 19) .. 'A', Screenline(1))
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1497 call test_override('ALL', 0)
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1498 set norightleft
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1499 bw!
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1500 endfunc
11289
e0309111d976 patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents: 11171
diff changeset
1501
e0309111d976 patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents: 11171
diff changeset
1502 func Test_edit_complete_very_long_name()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1503 " Long directory names only work on Unix.
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1504 CheckUnix
11319
2dc624388934 patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents: 11315
diff changeset
1505
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 29483
diff changeset
1506 let dirname = getcwd() . "/Xlongdir"
11319
2dc624388934 patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents: 11315
diff changeset
1507 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
1508 try
30393
409ddc3fa5ce patch 9.0.0532: edit test is flaky when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1509 call mkdir(longdirname, 'pR')
11319
2dc624388934 patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents: 11315
diff changeset
1510 catch /E739:/
2dc624388934 patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents: 11315
diff changeset
1511 " 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
1512 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
1513 return
2dc624388934 patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents: 11315
diff changeset
1514 endtry
2dc624388934 patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents: 11315
diff changeset
1515
16692
2e689fb67c91 patch 8.1.1348: running tests may cause the window to move
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1516 " Try to get the Vim window position before setting 'columns', so that we can
2e689fb67c91 patch 8.1.1348: running tests may cause the window to move
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1517 " move the window back to where it was.
11315
0c091a7c588c patch 8.0.0543: test_edit causes older xfce4-terminal to close
Christian Brabandt <cb@256bit.org>
parents: 11293
diff changeset
1518 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
1519 let winposy = getwinposy()
16692
2e689fb67c91 patch 8.1.1348: running tests may cause the window to move
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1520
2e689fb67c91 patch 8.1.1348: running tests may cause the window to move
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1521 if winposx >= 0 && winposy >= 0 && !has('gui_running')
2e689fb67c91 patch 8.1.1348: running tests may cause the window to move
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1522 " We did get the window position, but xterm may report the wrong numbers.
2e689fb67c91 patch 8.1.1348: running tests may cause the window to move
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1523 " Move the window to the reported position and compute any offset.
2e689fb67c91 patch 8.1.1348: running tests may cause the window to move
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1524 exe 'winpos ' . winposx . ' ' . winposy
2e689fb67c91 patch 8.1.1348: running tests may cause the window to move
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1525 sleep 100m
2e689fb67c91 patch 8.1.1348: running tests may cause the window to move
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1526 let x = getwinposx()
2e689fb67c91 patch 8.1.1348: running tests may cause the window to move
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1527 if x >= 0
2e689fb67c91 patch 8.1.1348: running tests may cause the window to move
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1528 let winposx += winposx - x
2e689fb67c91 patch 8.1.1348: running tests may cause the window to move
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1529 endif
2e689fb67c91 patch 8.1.1348: running tests may cause the window to move
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1530 let y = getwinposy()
2e689fb67c91 patch 8.1.1348: running tests may cause the window to move
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1531 if y >= 0
2e689fb67c91 patch 8.1.1348: running tests may cause the window to move
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1532 let winposy += winposy - y
2e689fb67c91 patch 8.1.1348: running tests may cause the window to move
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1533 endif
2e689fb67c91 patch 8.1.1348: running tests may cause the window to move
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1534 endif
2e689fb67c91 patch 8.1.1348: running tests may cause the window to move
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1535
11289
e0309111d976 patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents: 11171
diff changeset
1536 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
1537 " 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
1538 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
1539 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
1540
11289
e0309111d976 patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents: 11171
diff changeset
1541 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
1542 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
1543 new
29997
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29970
diff changeset
1544 exe "next Xnofile " . longfilename
11289
e0309111d976 patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents: 11171
diff changeset
1545 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
1546
e0309111d976 patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents: 11171
diff changeset
1547 bwipe!
e0309111d976 patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents: 11171
diff changeset
1548 exe 'bwipe! ' . longfilename
e0309111d976 patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents: 11171
diff changeset
1549 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
1550 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
1551 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
1552 endif
11289
e0309111d976 patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents: 11171
diff changeset
1553 set swapfile&
e0309111d976 patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents: 11171
diff changeset
1554 endfunc
12654
d03798bddf5e patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
1555
14409
9ffce640d0d3 patch 8.1.0219: expanding ## fails to escape backtick
Christian Brabandt <cb@256bit.org>
parents: 14039
diff changeset
1556 func Test_edit_backtick()
9ffce640d0d3 patch 8.1.0219: expanding ## fails to escape backtick
Christian Brabandt <cb@256bit.org>
parents: 14039
diff changeset
1557 next a\`b c
9ffce640d0d3 patch 8.1.0219: expanding ## fails to escape backtick
Christian Brabandt <cb@256bit.org>
parents: 14039
diff changeset
1558 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
1559 next
9ffce640d0d3 patch 8.1.0219: expanding ## fails to escape backtick
Christian Brabandt <cb@256bit.org>
parents: 14039
diff changeset
1560 call assert_equal('c', expand('%'))
9ffce640d0d3 patch 8.1.0219: expanding ## fails to escape backtick
Christian Brabandt <cb@256bit.org>
parents: 14039
diff changeset
1561 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
1562 endfunc
9ffce640d0d3 patch 8.1.0219: expanding ## fails to escape backtick
Christian Brabandt <cb@256bit.org>
parents: 14039
diff changeset
1563
12654
d03798bddf5e patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
1564 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
1565 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
1566 split
d03798bddf5e patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
1567 new
d03798bddf5e patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
1568 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
1569 3wincmd w
d03798bddf5e patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
1570 redraw!
d03798bddf5e patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
1571 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
1572 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
1573 only
d03798bddf5e patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
1574 endfunc
d03798bddf5e patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
1575
14033
bcda3b864c31 patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
1576 func Test_edit_alt()
bcda3b864c31 patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
1577 " 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
1578 new
bcda3b864c31 patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
1579 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
1580 w XAltFile
bcda3b864c31 patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
1581 $
bcda3b864c31 patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
1582 call assert_equal(3, line('.'))
bcda3b864c31 patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
1583 e Xother
bcda3b864c31 patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
1584 e #
bcda3b864c31 patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
1585 call assert_equal(3, line('.'))
bcda3b864c31 patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
1586
bcda3b864c31 patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
1587 bwipe XAltFile
bcda3b864c31 patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
1588 call delete('XAltFile')
bcda3b864c31 patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
1589 endfunc
14985
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1590
20187
79cc97206476 patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
1591 func Test_edit_InsertLeave()
14985
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1592 new
22651
fba5ccf33794 patch 8.2.1874: can't do something just before leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22588
diff changeset
1593 au InsertLeavePre * let g:did_au_pre = 1
14985
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1594 au InsertLeave * let g:did_au = 1
22651
fba5ccf33794 patch 8.2.1874: can't do something just before leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22588
diff changeset
1595 let g:did_au_pre = 0
14985
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1596 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
1597 call feedkeys("afoo\<Esc>", 'tx')
22651
fba5ccf33794 patch 8.2.1874: can't do something just before leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22588
diff changeset
1598 call assert_equal(1, g:did_au_pre)
14985
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1599 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
1600 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
1601
22651
fba5ccf33794 patch 8.2.1874: can't do something just before leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22588
diff changeset
1602 let g:did_au_pre = 0
14985
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1603 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
1604 call feedkeys("Sbar\<C-C>", 'tx')
22651
fba5ccf33794 patch 8.2.1874: can't do something just before leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22588
diff changeset
1605 call assert_equal(1, g:did_au_pre)
14985
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1606 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
1607 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
1608
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1609 inoremap x xx<Esc>
22651
fba5ccf33794 patch 8.2.1874: can't do something just before leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22588
diff changeset
1610 let g:did_au_pre = 0
14985
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1611 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
1612 call feedkeys("Saax", 'tx')
22651
fba5ccf33794 patch 8.2.1874: can't do something just before leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22588
diff changeset
1613 call assert_equal(1, g:did_au_pre)
14985
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1614 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
1615 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
1616
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1617 inoremap x xx<C-C>
22651
fba5ccf33794 patch 8.2.1874: can't do something just before leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22588
diff changeset
1618 let g:did_au_pre = 0
14985
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1619 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
1620 call feedkeys("Sbbx", 'tx')
22651
fba5ccf33794 patch 8.2.1874: can't do something just before leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22588
diff changeset
1621 call assert_equal(1, g:did_au_pre)
14985
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1622 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
1623 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
1624
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1625 bwipe!
22651
fba5ccf33794 patch 8.2.1874: can't do something just before leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 22588
diff changeset
1626 au! InsertLeave InsertLeavePre
14985
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1627 iunmap x
4ebda55537a5 patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents: 14409
diff changeset
1628 endfunc
16419
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16011
diff changeset
1629
20187
79cc97206476 patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
1630 func Test_edit_InsertLeave_undo()
79cc97206476 patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
1631 new XtestUndo
79cc97206476 patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
1632 set undofile
79cc97206476 patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
1633 au InsertLeave * wall
79cc97206476 patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
1634 exe "normal ofoo\<Esc>"
79cc97206476 patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
1635 call assert_equal(2, line('$'))
79cc97206476 patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
1636 normal u
79cc97206476 patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
1637 call assert_equal(1, line('$'))
79cc97206476 patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
1638
79cc97206476 patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
1639 bwipe!
79cc97206476 patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
1640 au! InsertLeave
79cc97206476 patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
1641 call delete('XtestUndo')
20861
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1642 call delete(undofile('XtestUndo'))
20187
79cc97206476 patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
1643 set undofile&
79cc97206476 patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
1644 endfunc
79cc97206476 patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
1645
16419
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16011
diff changeset
1646 " Test for inserting characters using CTRL-V followed by a number.
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16011
diff changeset
1647 func Test_edit_special_chars()
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16011
diff changeset
1648 new
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16011
diff changeset
1649
27490
fb4c30606b4a patch 8.2.4273: the EBCDIC support is outdated
Bram Moolenaar <Bram@vim.org>
parents: 27350
diff changeset
1650 let t = "o\<C-V>65\<C-V>x42\<C-V>o103 \<C-V>33a\<C-V>xfg\<C-V>o78\<Esc>"
16419
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16011
diff changeset
1651
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16011
diff changeset
1652 exe "normal " . t
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16011
diff changeset
1653 call assert_equal("ABC !a\<C-O>g\<C-G>8", getline(2))
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16011
diff changeset
1654
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16011
diff changeset
1655 close!
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16011
diff changeset
1656 endfunc
17984
2ea47dee7ddd patch 8.1.1988: :startinsert! does not work the same way as "A"
Bram Moolenaar <Bram@vim.org>
parents: 17857
diff changeset
1657
2ea47dee7ddd patch 8.1.1988: :startinsert! does not work the same way as "A"
Bram Moolenaar <Bram@vim.org>
parents: 17857
diff changeset
1658 func Test_edit_startinsert()
2ea47dee7ddd patch 8.1.1988: :startinsert! does not work the same way as "A"
Bram Moolenaar <Bram@vim.org>
parents: 17857
diff changeset
1659 new
2ea47dee7ddd patch 8.1.1988: :startinsert! does not work the same way as "A"
Bram Moolenaar <Bram@vim.org>
parents: 17857
diff changeset
1660 set backspace+=start
2ea47dee7ddd patch 8.1.1988: :startinsert! does not work the same way as "A"
Bram Moolenaar <Bram@vim.org>
parents: 17857
diff changeset
1661 call setline(1, 'foobar')
2ea47dee7ddd patch 8.1.1988: :startinsert! does not work the same way as "A"
Bram Moolenaar <Bram@vim.org>
parents: 17857
diff changeset
1662 call feedkeys("A\<C-U>\<Esc>", 'xt')
2ea47dee7ddd patch 8.1.1988: :startinsert! does not work the same way as "A"
Bram Moolenaar <Bram@vim.org>
parents: 17857
diff changeset
1663 call assert_equal('', getline(1))
2ea47dee7ddd patch 8.1.1988: :startinsert! does not work the same way as "A"
Bram Moolenaar <Bram@vim.org>
parents: 17857
diff changeset
1664
2ea47dee7ddd patch 8.1.1988: :startinsert! does not work the same way as "A"
Bram Moolenaar <Bram@vim.org>
parents: 17857
diff changeset
1665 call setline(1, 'foobar')
2ea47dee7ddd patch 8.1.1988: :startinsert! does not work the same way as "A"
Bram Moolenaar <Bram@vim.org>
parents: 17857
diff changeset
1666 call feedkeys(":startinsert!\<CR>\<C-U>\<Esc>", 'xt')
2ea47dee7ddd patch 8.1.1988: :startinsert! does not work the same way as "A"
Bram Moolenaar <Bram@vim.org>
parents: 17857
diff changeset
1667 call assert_equal('', getline(1))
2ea47dee7ddd patch 8.1.1988: :startinsert! does not work the same way as "A"
Bram Moolenaar <Bram@vim.org>
parents: 17857
diff changeset
1668
2ea47dee7ddd patch 8.1.1988: :startinsert! does not work the same way as "A"
Bram Moolenaar <Bram@vim.org>
parents: 17857
diff changeset
1669 set backspace&
2ea47dee7ddd patch 8.1.1988: :startinsert! does not work the same way as "A"
Bram Moolenaar <Bram@vim.org>
parents: 17857
diff changeset
1670 bwipe!
2ea47dee7ddd patch 8.1.1988: :startinsert! does not work the same way as "A"
Bram Moolenaar <Bram@vim.org>
parents: 17857
diff changeset
1671 endfunc
18534
7dd83b5325e9 patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 17984
diff changeset
1672
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
1673 " Test for :startreplace and :startgreplace
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
1674 func Test_edit_startreplace()
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
1675 new
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
1676 call setline(1, 'abc')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
1677 call feedkeys("l:startreplace\<CR>xyz\e", 'xt')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
1678 call assert_equal('axyz', getline(1))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
1679 call feedkeys("0:startreplace!\<CR>abc\e", 'xt')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
1680 call assert_equal('axyzabc', getline(1))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
1681 call setline(1, "a\tb")
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
1682 call feedkeys("0l:startgreplace\<CR>xyz\e", 'xt')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
1683 call assert_equal("axyz\tb", getline(1))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
1684 call feedkeys("0i\<C-R>=execute('startreplace')\<CR>12\e", 'xt')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
1685 call assert_equal("12axyz\tb", getline(1))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
1686 close!
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
1687 endfunc
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
1688
18534
7dd83b5325e9 patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 17984
diff changeset
1689 func Test_edit_noesckeys()
18538
c4d97a18af37 patch 8.1.2263: 'noesckeys' test fails in GUI
Bram Moolenaar <Bram@vim.org>
parents: 18534
diff changeset
1690 CheckNotGui
18534
7dd83b5325e9 patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 17984
diff changeset
1691 new
7dd83b5325e9 patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 17984
diff changeset
1692
7dd83b5325e9 patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 17984
diff changeset
1693 " <Left> moves cursor when 'esckeys' is set
7dd83b5325e9 patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 17984
diff changeset
1694 exe "set t_kl=\<Esc>OD"
7dd83b5325e9 patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 17984
diff changeset
1695 set esckeys
7dd83b5325e9 patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 17984
diff changeset
1696 call feedkeys("axyz\<Esc>ODX", "xt")
7dd83b5325e9 patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 17984
diff changeset
1697 call assert_equal("xyXz", getline(1))
7dd83b5325e9 patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 17984
diff changeset
1698
7dd83b5325e9 patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 17984
diff changeset
1699 " <Left> exits Insert mode when 'esckeys' is off
7dd83b5325e9 patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 17984
diff changeset
1700 set noesckeys
7dd83b5325e9 patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 17984
diff changeset
1701 call setline(1, '')
7dd83b5325e9 patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 17984
diff changeset
1702 call feedkeys("axyz\<Esc>ODX", "xt")
7dd83b5325e9 patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 17984
diff changeset
1703 call assert_equal(["DX", "xyz"], getline(1, 2))
7dd83b5325e9 patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 17984
diff changeset
1704
7dd83b5325e9 patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 17984
diff changeset
1705 bwipe!
7dd83b5325e9 patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 17984
diff changeset
1706 set esckeys
7dd83b5325e9 patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 17984
diff changeset
1707 endfunc
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
1708
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
1709 " Test for running an invalid ex command in insert mode using CTRL-O
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
1710 func Test_edit_ctrl_o_invalid_cmd()
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
1711 new
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
1712 set showmode showcmd
20861
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1713 " Avoid a sleep of 3 seconds. Zero might have side effects.
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1714 call test_override('ui_delay', 50)
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
1715 let caught_e492 = 0
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
1716 try
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
1717 call feedkeys("i\<C-O>:invalid\<CR>abc\<Esc>", "xt")
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
1718 catch /E492:/
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
1719 let caught_e492 = 1
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
1720 endtry
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
1721 call assert_equal(1, caught_e492)
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
1722 call assert_equal('abc', getline(1))
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
1723 set showmode& showcmd&
20861
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1724 call test_override('ui_delay', 0)
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1725 close!
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1726 endfunc
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1727
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1728 " Test for editing a file with a very long name
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1729 func Test_edit_illegal_filename()
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1730 CheckEnglish
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1731 new
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1732 redir => msg
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1733 exe 'edit ' . repeat('f', 5000)
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1734 redir END
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1735 call assert_match("Illegal file name$", split(msg, "\n")[0])
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1736 close!
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1737 endfunc
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1738
22490
23a5977d7211 patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1739 " Test for editing a directory
23a5977d7211 patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1740 func Test_edit_is_a_directory()
23a5977d7211 patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1741 CheckEnglish
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 29483
diff changeset
1742 let dirname = getcwd() . "/Xeditdir"
22490
23a5977d7211 patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1743 call mkdir(dirname, 'p')
23a5977d7211 patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1744
23a5977d7211 patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1745 new
23a5977d7211 patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1746 redir => msg
23a5977d7211 patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1747 exe 'edit' dirname
23a5977d7211 patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1748 redir END
23a5977d7211 patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1749 call assert_match("is a directory$", split(msg, "\n")[0])
23a5977d7211 patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1750 bwipe!
23a5977d7211 patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1751
23a5977d7211 patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1752 let dirname .= '/'
23a5977d7211 patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1753
23a5977d7211 patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1754 new
23a5977d7211 patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1755 redir => msg
23a5977d7211 patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1756 exe 'edit' dirname
23a5977d7211 patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1757 redir END
23a5977d7211 patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1758 call assert_match("is a directory$", split(msg, "\n")[0])
23a5977d7211 patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1759 bwipe!
23a5977d7211 patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1760
23a5977d7211 patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1761 call delete(dirname, 'rf')
23a5977d7211 patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1762 endfunc
23a5977d7211 patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1763
20861
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1764 " Test for editing a file using invalid file encoding
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1765 func Test_edit_invalid_encoding()
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1766 CheckEnglish
30393
409ddc3fa5ce patch 9.0.0532: edit test is flaky when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1767 call writefile([], 'Xinvfile', 'D')
20861
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1768 redir => msg
29997
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29970
diff changeset
1769 new ++enc=axbyc Xinvfile
20861
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1770 redir END
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1771 call assert_match('\[NOT converted\]', msg)
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
1772 close!
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
1773 endfunc
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
1774
20861
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1775 " Test for the "charconvert" option
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1776 func Test_edit_charconvert()
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1777 CheckEnglish
30393
409ddc3fa5ce patch 9.0.0532: edit test is flaky when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1778 call writefile(['one', 'two'], 'Xccfile', 'D')
20861
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1779
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1780 " set 'charconvert' to a non-existing function
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1781 set charconvert=NonExitingFunc()
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1782 new
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1783 let caught_e117 = v:false
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1784 try
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1785 redir => msg
29997
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29970
diff changeset
1786 edit ++enc=axbyc Xccfile
20861
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1787 catch /E117:/
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1788 let caught_e117 = v:true
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1789 finally
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1790 redir END
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1791 endtry
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1792 call assert_true(caught_e117)
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1793 call assert_equal(['one', 'two'], getline(1, '$'))
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1794 call assert_match("Conversion with 'charconvert' failed", msg)
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1795 close!
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1796 set charconvert&
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1797
33223
def9fc5c92d1 patch 9.0.1886: Various Typos
Christian Brabandt <cb@256bit.org>
parents: 32194
diff changeset
1798 " 'charconvert' function doesn't create an output file
20861
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1799 func Cconv1()
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1800 endfunc
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1801 set charconvert=Cconv1()
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1802 new
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1803 redir => msg
29997
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29970
diff changeset
1804 edit ++enc=axbyc Xccfile
20861
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1805 redir END
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1806 call assert_equal(['one', 'two'], getline(1, '$'))
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1807 call assert_match("can't read output of 'charconvert'", msg)
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1808 close!
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1809 delfunc Cconv1
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1810 set charconvert&
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1811
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1812 " 'charconvert' function to convert to upper case
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1813 func Cconv2()
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1814 let data = readfile(v:fname_in)
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1815 call map(data, 'toupper(v:val)')
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1816 call writefile(data, v:fname_out)
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1817 endfunc
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1818 set charconvert=Cconv2()
29997
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29970
diff changeset
1819 new Xccfile
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29970
diff changeset
1820 write ++enc=ucase Xccfile1
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29970
diff changeset
1821 call assert_equal(['ONE', 'TWO'], readfile('Xccfile1'))
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29970
diff changeset
1822 call delete('Xccfile1')
20861
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1823 close!
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1824 delfunc Cconv2
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1825 set charconvert&
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1826
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1827 " 'charconvert' function removes the input file
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1828 func Cconv3()
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1829 call delete(v:fname_in)
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1830 endfunc
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1831 set charconvert=Cconv3()
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1832 new
29997
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29970
diff changeset
1833 call assert_fails('edit ++enc=lcase Xccfile', 'E202:')
20861
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1834 call assert_equal([''], getline(1, '$'))
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1835 close!
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1836 delfunc Cconv3
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1837 set charconvert&
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1838 endfunc
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1839
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1840 " Test for editing a file without read permission
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1841 func Test_edit_file_no_read_perm()
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1842 CheckUnix
24164
2259c73cc1d9 patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents: 24057
diff changeset
1843 CheckNotRoot
2259c73cc1d9 patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents: 24057
diff changeset
1844
30393
409ddc3fa5ce patch 9.0.0532: edit test is flaky when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1845 call writefile(['one', 'two'], 'Xnrpfile', 'D')
29997
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29970
diff changeset
1846 call setfperm('Xnrpfile', '-w-------')
20861
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1847 new
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1848 redir => msg
29997
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29970
diff changeset
1849 edit Xnrpfile
20861
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1850 redir END
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1851 call assert_equal(1, &readonly)
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1852 call assert_equal([''], getline(1, '$'))
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1853 call assert_match('\[Permission Denied\]', msg)
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1854 close!
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1855 endfunc
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20832
diff changeset
1856
28371
c3a7be75ef16 patch 8.2.4711: when 'insermode' is set :edit from <Cmd> mapping misbehaves
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
1857 " Using :edit without leaving 'insertmode' should not cause Insert mode to be
c3a7be75ef16 patch 8.2.4711: when 'insermode' is set :edit from <Cmd> mapping misbehaves
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
1858 " re-entered immediately after <C-L>
c3a7be75ef16 patch 8.2.4711: when 'insermode' is set :edit from <Cmd> mapping misbehaves
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
1859 func Test_edit_insertmode_ex_edit()
c3a7be75ef16 patch 8.2.4711: when 'insermode' is set :edit from <Cmd> mapping misbehaves
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
1860 CheckRunVimInTerminal
c3a7be75ef16 patch 8.2.4711: when 'insermode' is set :edit from <Cmd> mapping misbehaves
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
1861
c3a7be75ef16 patch 8.2.4711: when 'insermode' is set :edit from <Cmd> mapping misbehaves
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
1862 let lines =<< trim END
c3a7be75ef16 patch 8.2.4711: when 'insermode' is set :edit from <Cmd> mapping misbehaves
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
1863 set insertmode noruler
c3a7be75ef16 patch 8.2.4711: when 'insermode' is set :edit from <Cmd> mapping misbehaves
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
1864 inoremap <C-B> <Cmd>edit Xfoo<CR>
c3a7be75ef16 patch 8.2.4711: when 'insermode' is set :edit from <Cmd> mapping misbehaves
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
1865 END
30393
409ddc3fa5ce patch 9.0.0532: edit test is flaky when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1866 call writefile(lines, 'Xtest_edit_insertmode_ex_edit', 'D')
28371
c3a7be75ef16 patch 8.2.4711: when 'insermode' is set :edit from <Cmd> mapping misbehaves
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
1867
30393
409ddc3fa5ce patch 9.0.0532: edit test is flaky when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1868 let buf = RunVimInTerminal('-S Xtest_edit_insertmode_ex_edit', #{rows: 6, wait_for_ruler: 0})
409ddc3fa5ce patch 9.0.0532: edit test is flaky when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1869 " Somehow when using valgrind "INSERT" does not show up unless we send
409ddc3fa5ce patch 9.0.0532: edit test is flaky when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1870 " something to the terminal.
409ddc3fa5ce patch 9.0.0532: edit test is flaky when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1871 for i in range(30)
409ddc3fa5ce patch 9.0.0532: edit test is flaky when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1872 if term_getline(buf, 6) =~ 'INSERT'
409ddc3fa5ce patch 9.0.0532: edit test is flaky when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1873 break
409ddc3fa5ce patch 9.0.0532: edit test is flaky when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1874 endif
409ddc3fa5ce patch 9.0.0532: edit test is flaky when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1875 call term_sendkeys(buf, "-")
409ddc3fa5ce patch 9.0.0532: edit test is flaky when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1876 sleep 100m
409ddc3fa5ce patch 9.0.0532: edit test is flaky when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1877 endfor
29222
6b4c1ca1436e patch 8.2.5130: edit test for mode message fails when using valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29014
diff changeset
1878 call WaitForAssert({-> assert_match('^-- INSERT --\s*$', term_getline(buf, 6))})
28371
c3a7be75ef16 patch 8.2.4711: when 'insermode' is set :edit from <Cmd> mapping misbehaves
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
1879 call term_sendkeys(buf, "\<C-B>\<C-L>")
29222
6b4c1ca1436e patch 8.2.5130: edit test for mode message fails when using valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29014
diff changeset
1880 call WaitForAssert({-> assert_notmatch('^-- INSERT --\s*$', term_getline(buf, 6))})
28371
c3a7be75ef16 patch 8.2.4711: when 'insermode' is set :edit from <Cmd> mapping misbehaves
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
1881
c3a7be75ef16 patch 8.2.4711: when 'insermode' is set :edit from <Cmd> mapping misbehaves
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
1882 " clean up
c3a7be75ef16 patch 8.2.4711: when 'insermode' is set :edit from <Cmd> mapping misbehaves
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
1883 call StopVimInTerminal(buf)
c3a7be75ef16 patch 8.2.4711: when 'insermode' is set :edit from <Cmd> mapping misbehaves
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
1884 endfunc
c3a7be75ef16 patch 8.2.4711: when 'insermode' is set :edit from <Cmd> mapping misbehaves
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
1885
20941
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1886 " Pressing escape in 'insertmode' should beep
29222
6b4c1ca1436e patch 8.2.5130: edit test for mode message fails when using valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29014
diff changeset
1887 " FIXME: Execute this later, when using valgrind it makes the next test
6b4c1ca1436e patch 8.2.5130: edit test for mode message fails when using valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29014
diff changeset
1888 " Test_edit_insertmode_ex_edit() fail.
6b4c1ca1436e patch 8.2.5130: edit test for mode message fails when using valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29014
diff changeset
1889 func Test_z_edit_insertmode_esc_beeps()
20941
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1890 new
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1891 set insertmode
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1892 call assert_beeps("call feedkeys(\"one\<Esc>\", 'xt')")
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1893 set insertmode&
29222
6b4c1ca1436e patch 8.2.5130: edit test for mode message fails when using valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29014
diff changeset
1894 " unsupported "CTRL-G l" command should beep in insert mode.
20941
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1895 call assert_beeps("normal i\<C-G>l")
29222
6b4c1ca1436e patch 8.2.5130: edit test for mode message fails when using valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29014
diff changeset
1896 bwipe!
20941
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1897 endfunc
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1898
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1899 " Test for 'hkmap' and 'hkmapp'
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1900 func Test_edit_hkmap()
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1901 CheckFeature rightleft
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1902 if has('win32') && !has('gui')
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1903 throw 'Skipped: fails on the MS-Windows terminal version'
20941
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1904 endif
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1905 new
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1906
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1907 set revins hkmap
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1908 let str = 'abcdefghijklmnopqrstuvwxyz'
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1909 let str ..= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1910 let str ..= '`/'',.;'
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1911 call feedkeys('i' .. str, 'xt')
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1912 let expected = "óõú,.;"
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1913 let expected ..= "ZYXWVUTSRQPONMLKJIHGFEDCBA"
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1914 let expected ..= "æèñ'äåàãø/ôíîöêìçïéòë÷âáðù"
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1915 call assert_equal(expected, getline(1))
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1916
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1917 %d
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1918 set revins hkmap hkmapp
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1919 let str = 'abcdefghijklmnopqrstuvwxyz'
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1920 let str ..= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1921 call feedkeys('i' .. str, 'xt')
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1922 let expected = "õYXWVUTSRQóOïíLKJIHGFEDêBA"
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1923 let expected ..= "öòXùåèúæø'ôñðîì÷çéäâóǟãëáà"
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1924 call assert_equal(expected, getline(1))
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1925
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1926 set revins& hkmap& hkmapp&
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1927 close!
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1928 endfunc
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1929
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1930 " Test for 'allowrevins' and using CTRL-_ in insert mode
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1931 func Test_edit_allowrevins()
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1932 CheckFeature rightleft
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1933 new
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1934 set allowrevins
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1935 call feedkeys("iABC\<C-_>DEF\<C-_>GHI", 'xt')
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1936 call assert_equal('ABCFEDGHI', getline(1))
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1937 set allowrevins&
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1938 close!
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1939 endfunc
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1940
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1941 " Test for inserting a register in insert mode using CTRL-R
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1942 func Test_edit_insert_reg()
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1943 new
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1944 let g:Line = ''
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1945 func SaveFirstLine()
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1946 let g:Line = Screenline(1)
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1947 return 'r'
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1948 endfunc
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1949 inoremap <expr> <buffer> <F2> SaveFirstLine()
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1950 call test_override('redraw_flag', 1)
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1951 call test_override('char_avail', 1)
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1952 let @r = 'sample'
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1953 call feedkeys("a\<C-R>=SaveFirstLine()\<CR>", "xt")
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1954 call assert_equal('"', g:Line)
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1955 call test_override('ALL', 0)
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1956 close!
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1957 endfunc
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1958
32194
baafb135b0cb patch 9.0.1428: cursor in wrong position when leaving insert mode
Bram Moolenaar <Bram@vim.org>
parents: 32049
diff changeset
1959 " Test for positioning cursor after CTRL-R expression failed
baafb135b0cb patch 9.0.1428: cursor in wrong position when leaving insert mode
Bram Moolenaar <Bram@vim.org>
parents: 32049
diff changeset
1960 func Test_edit_ctrl_r_failed()
baafb135b0cb patch 9.0.1428: cursor in wrong position when leaving insert mode
Bram Moolenaar <Bram@vim.org>
parents: 32049
diff changeset
1961 CheckRunVimInTerminal
baafb135b0cb patch 9.0.1428: cursor in wrong position when leaving insert mode
Bram Moolenaar <Bram@vim.org>
parents: 32049
diff changeset
1962
baafb135b0cb patch 9.0.1428: cursor in wrong position when leaving insert mode
Bram Moolenaar <Bram@vim.org>
parents: 32049
diff changeset
1963 let buf = RunVimInTerminal('', #{rows: 6, cols: 60})
baafb135b0cb patch 9.0.1428: cursor in wrong position when leaving insert mode
Bram Moolenaar <Bram@vim.org>
parents: 32049
diff changeset
1964
34944
1e6f45f5ca23 patch 9.1.0329: String interpolation fails for Dict type
Christian Brabandt <cb@256bit.org>
parents: 34761
diff changeset
1965 " trying to insert a blob produces an error
1e6f45f5ca23 patch 9.1.0329: String interpolation fails for Dict type
Christian Brabandt <cb@256bit.org>
parents: 34761
diff changeset
1966 call term_sendkeys(buf, "i\<C-R>=0z\<CR>")
32194
baafb135b0cb patch 9.0.1428: cursor in wrong position when leaving insert mode
Bram Moolenaar <Bram@vim.org>
parents: 32049
diff changeset
1967
baafb135b0cb patch 9.0.1428: cursor in wrong position when leaving insert mode
Bram Moolenaar <Bram@vim.org>
parents: 32049
diff changeset
1968 " ending Insert mode should put the cursor back on the ':'
baafb135b0cb patch 9.0.1428: cursor in wrong position when leaving insert mode
Bram Moolenaar <Bram@vim.org>
parents: 32049
diff changeset
1969 call term_sendkeys(buf, ":\<Esc>")
baafb135b0cb patch 9.0.1428: cursor in wrong position when leaving insert mode
Bram Moolenaar <Bram@vim.org>
parents: 32049
diff changeset
1970 call VerifyScreenDump(buf, 'Test_edit_ctlr_r_failed_1', {})
baafb135b0cb patch 9.0.1428: cursor in wrong position when leaving insert mode
Bram Moolenaar <Bram@vim.org>
parents: 32049
diff changeset
1971
baafb135b0cb patch 9.0.1428: cursor in wrong position when leaving insert mode
Bram Moolenaar <Bram@vim.org>
parents: 32049
diff changeset
1972 call StopVimInTerminal(buf)
baafb135b0cb patch 9.0.1428: cursor in wrong position when leaving insert mode
Bram Moolenaar <Bram@vim.org>
parents: 32049
diff changeset
1973 endfunc
baafb135b0cb patch 9.0.1428: cursor in wrong position when leaving insert mode
Bram Moolenaar <Bram@vim.org>
parents: 32049
diff changeset
1974
20941
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1975 " When a character is inserted at the last position of the last line in a
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1976 " window, the window contents should be scrolled one line up. If the top line
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1977 " is part of a fold, then the entire fold should be scrolled up.
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1978 func Test_edit_lastline_scroll()
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1979 new
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1980 let h = winheight(0)
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1981 let lines = ['one', 'two', 'three']
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1982 let lines += repeat(['vim'], h - 4)
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1983 call setline(1, lines)
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1984 call setline(h, repeat('x', winwidth(0) - 1))
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1985 call feedkeys("GAx", 'xt')
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1986 redraw!
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1987 call assert_equal(h - 1, winline())
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1988 call assert_equal(2, line('w0'))
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1989
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1990 " scroll with a fold
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1991 1,2fold
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1992 normal gg
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1993 call setline(h + 1, repeat('x', winwidth(0) - 1))
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1994 call feedkeys("GAx", 'xt')
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1995 redraw!
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1996 call assert_equal(h - 1, winline())
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1997 call assert_equal(3, line('w0'))
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1998
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
1999 close!
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
2000 endfunc
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
2001
22588
050cff1294ab patch 8.2.1842: crash when USE_FNAME_CASE is defined and using :browse
Bram Moolenaar <Bram@vim.org>
parents: 22490
diff changeset
2002 func Test_edit_browse()
050cff1294ab patch 8.2.1842: crash when USE_FNAME_CASE is defined and using :browse
Bram Moolenaar <Bram@vim.org>
parents: 22490
diff changeset
2003 " in the GUI this opens a file picker, we only test the terminal behavior
050cff1294ab patch 8.2.1842: crash when USE_FNAME_CASE is defined and using :browse
Bram Moolenaar <Bram@vim.org>
parents: 22490
diff changeset
2004 CheckNotGui
050cff1294ab patch 8.2.1842: crash when USE_FNAME_CASE is defined and using :browse
Bram Moolenaar <Bram@vim.org>
parents: 22490
diff changeset
2005
050cff1294ab patch 8.2.1842: crash when USE_FNAME_CASE is defined and using :browse
Bram Moolenaar <Bram@vim.org>
parents: 22490
diff changeset
2006 " ":browse xxx" checks for the FileExplorer augroup and assumes editing "."
050cff1294ab patch 8.2.1842: crash when USE_FNAME_CASE is defined and using :browse
Bram Moolenaar <Bram@vim.org>
parents: 22490
diff changeset
2007 " works then.
050cff1294ab patch 8.2.1842: crash when USE_FNAME_CASE is defined and using :browse
Bram Moolenaar <Bram@vim.org>
parents: 22490
diff changeset
2008 augroup FileExplorer
050cff1294ab patch 8.2.1842: crash when USE_FNAME_CASE is defined and using :browse
Bram Moolenaar <Bram@vim.org>
parents: 22490
diff changeset
2009 au!
050cff1294ab patch 8.2.1842: crash when USE_FNAME_CASE is defined and using :browse
Bram Moolenaar <Bram@vim.org>
parents: 22490
diff changeset
2010 augroup END
050cff1294ab patch 8.2.1842: crash when USE_FNAME_CASE is defined and using :browse
Bram Moolenaar <Bram@vim.org>
parents: 22490
diff changeset
2011
050cff1294ab patch 8.2.1842: crash when USE_FNAME_CASE is defined and using :browse
Bram Moolenaar <Bram@vim.org>
parents: 22490
diff changeset
2012 " When the USE_FNAME_CASE is defined this used to cause a crash.
050cff1294ab patch 8.2.1842: crash when USE_FNAME_CASE is defined and using :browse
Bram Moolenaar <Bram@vim.org>
parents: 22490
diff changeset
2013 browse enew
050cff1294ab patch 8.2.1842: crash when USE_FNAME_CASE is defined and using :browse
Bram Moolenaar <Bram@vim.org>
parents: 22490
diff changeset
2014 bwipe!
050cff1294ab patch 8.2.1842: crash when USE_FNAME_CASE is defined and using :browse
Bram Moolenaar <Bram@vim.org>
parents: 22490
diff changeset
2015
050cff1294ab patch 8.2.1842: crash when USE_FNAME_CASE is defined and using :browse
Bram Moolenaar <Bram@vim.org>
parents: 22490
diff changeset
2016 browse split
050cff1294ab patch 8.2.1842: crash when USE_FNAME_CASE is defined and using :browse
Bram Moolenaar <Bram@vim.org>
parents: 22490
diff changeset
2017 bwipe!
050cff1294ab patch 8.2.1842: crash when USE_FNAME_CASE is defined and using :browse
Bram Moolenaar <Bram@vim.org>
parents: 22490
diff changeset
2018 endfunc
050cff1294ab patch 8.2.1842: crash when USE_FNAME_CASE is defined and using :browse
Bram Moolenaar <Bram@vim.org>
parents: 22490
diff changeset
2019
22724
51bc501a13ca patch 8.2.1910: reading past the end of the command line
Bram Moolenaar <Bram@vim.org>
parents: 22651
diff changeset
2020 func Test_read_invalid()
51bc501a13ca patch 8.2.1910: reading past the end of the command line
Bram Moolenaar <Bram@vim.org>
parents: 22651
diff changeset
2021 set encoding=latin1
51bc501a13ca patch 8.2.1910: reading past the end of the command line
Bram Moolenaar <Bram@vim.org>
parents: 22651
diff changeset
2022 " This was not properly checking for going past the end.
51bc501a13ca patch 8.2.1910: reading past the end of the command line
Bram Moolenaar <Bram@vim.org>
parents: 22651
diff changeset
2023 call assert_fails('r`=', 'E484')
51bc501a13ca patch 8.2.1910: reading past the end of the command line
Bram Moolenaar <Bram@vim.org>
parents: 22651
diff changeset
2024 set encoding=utf-8
51bc501a13ca patch 8.2.1910: reading past the end of the command line
Bram Moolenaar <Bram@vim.org>
parents: 22651
diff changeset
2025 endfunc
51bc501a13ca patch 8.2.1910: reading past the end of the command line
Bram Moolenaar <Bram@vim.org>
parents: 22651
diff changeset
2026
24882
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24204
diff changeset
2027 " Test for the 'revins' option
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24204
diff changeset
2028 func Test_edit_revins()
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24204
diff changeset
2029 CheckFeature rightleft
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24204
diff changeset
2030 new
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24204
diff changeset
2031 set revins
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24204
diff changeset
2032 exe "normal! ione\ttwo three"
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24204
diff changeset
2033 call assert_equal("eerht owt\teno", getline(1))
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24204
diff changeset
2034 call setline(1, "one\ttwo three")
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24204
diff changeset
2035 normal! gg$bi a
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24204
diff changeset
2036 call assert_equal("one\ttwo a three", getline(1))
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24204
diff changeset
2037 exe "normal! $bi\<BS>\<BS>"
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24204
diff changeset
2038 call assert_equal("one\ttwo a ree", getline(1))
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24204
diff changeset
2039 exe "normal! 0wi\<C-W>"
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24204
diff changeset
2040 call assert_equal("one\t a ree", getline(1))
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24204
diff changeset
2041 exe "normal! 0wi\<C-U>"
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24204
diff changeset
2042 call assert_equal("one\t ", getline(1))
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24204
diff changeset
2043 " newline in insert mode starts at the end of the line
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24204
diff changeset
2044 call setline(1, 'one two three')
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24204
diff changeset
2045 exe "normal! wi\nfour"
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24204
diff changeset
2046 call assert_equal(['one two three', 'ruof'], getline(1, '$'))
34674
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2047 set backspace=indent,eol,start
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2048 exe "normal! ggA\<BS>:"
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2049 call assert_equal(['one two three:ruof'], getline(1, '$'))
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2050 set revins& backspace&
24882
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24204
diff changeset
2051 bw!
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24204
diff changeset
2052 endfunc
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24204
diff changeset
2053
25786
ec62e0764ffa patch 8.2.3428: using freed memory when replacing
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
2054 " Test for getting the character of the line below after "p"
ec62e0764ffa patch 8.2.3428: using freed memory when replacing
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
2055 func Test_edit_put_CTRL_E()
ec62e0764ffa patch 8.2.3428: using freed memory when replacing
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
2056 set encoding=latin1
ec62e0764ffa patch 8.2.3428: using freed memory when replacing
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
2057 new
ec62e0764ffa patch 8.2.3428: using freed memory when replacing
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
2058 let @" = ''
ec62e0764ffa patch 8.2.3428: using freed memory when replacing
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
2059 sil! norm orggRx
ec62e0764ffa patch 8.2.3428: using freed memory when replacing
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
2060 sil! norm pr
ec62e0764ffa patch 8.2.3428: using freed memory when replacing
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
2061 call assert_equal(['r', 'r'], getline(1, 2))
ec62e0764ffa patch 8.2.3428: using freed memory when replacing
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
2062 bwipe!
ec62e0764ffa patch 8.2.3428: using freed memory when replacing
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
2063 set encoding=utf-8
ec62e0764ffa patch 8.2.3428: using freed memory when replacing
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
2064 endfunc
ec62e0764ffa patch 8.2.3428: using freed memory when replacing
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
2065
26067
6a55d46e83cd patch 8.2.3567: CTRL-I in Insert mode is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26042
diff changeset
2066 " Test toggling of input method. See :help i_CTRL-^
6a55d46e83cd patch 8.2.3567: CTRL-I in Insert mode is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26042
diff changeset
2067 func Test_edit_CTRL_hat()
6a55d46e83cd patch 8.2.3567: CTRL-I in Insert mode is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26042
diff changeset
2068 CheckFeature xim
26069
33ae003bb569 patch 8.2.3568: ctrl-hat test fails with Athena and Motif
Bram Moolenaar <Bram@vim.org>
parents: 26067
diff changeset
2069
28303
9849df834f1d patch 8.2.4677: the Athena GUI support is outdated
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
2070 " FIXME: test fails with Motif GUI.
26069
33ae003bb569 patch 8.2.3568: ctrl-hat test fails with Athena and Motif
Bram Moolenaar <Bram@vim.org>
parents: 26067
diff changeset
2071 " test also fails when running in the GUI.
33ae003bb569 patch 8.2.3568: ctrl-hat test fails with Athena and Motif
Bram Moolenaar <Bram@vim.org>
parents: 26067
diff changeset
2072 CheckFeature gui_gtk
33ae003bb569 patch 8.2.3568: ctrl-hat test fails with Athena and Motif
Bram Moolenaar <Bram@vim.org>
parents: 26067
diff changeset
2073 CheckNotGui
26067
6a55d46e83cd patch 8.2.3567: CTRL-I in Insert mode is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26042
diff changeset
2074
6a55d46e83cd patch 8.2.3567: CTRL-I in Insert mode is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26042
diff changeset
2075 new
6a55d46e83cd patch 8.2.3567: CTRL-I in Insert mode is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26042
diff changeset
2076
6a55d46e83cd patch 8.2.3567: CTRL-I in Insert mode is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26042
diff changeset
2077 call assert_equal(0, &iminsert)
6a55d46e83cd patch 8.2.3567: CTRL-I in Insert mode is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26042
diff changeset
2078 call feedkeys("i\<C-^>", 'xt')
6a55d46e83cd patch 8.2.3567: CTRL-I in Insert mode is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26042
diff changeset
2079 call assert_equal(2, &iminsert)
6a55d46e83cd patch 8.2.3567: CTRL-I in Insert mode is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26042
diff changeset
2080 call feedkeys("i\<C-^>", 'xt')
6a55d46e83cd patch 8.2.3567: CTRL-I in Insert mode is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26042
diff changeset
2081 call assert_equal(0, &iminsert)
6a55d46e83cd patch 8.2.3567: CTRL-I in Insert mode is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26042
diff changeset
2082
6a55d46e83cd patch 8.2.3567: CTRL-I in Insert mode is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26042
diff changeset
2083 bwipe!
6a55d46e83cd patch 8.2.3567: CTRL-I in Insert mode is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26042
diff changeset
2084 endfunc
6a55d46e83cd patch 8.2.3567: CTRL-I in Insert mode is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26042
diff changeset
2085
27090
5e65d802bd52 patch 8.2.4074: going over the end of NameBuff
Bram Moolenaar <Bram@vim.org>
parents: 26921
diff changeset
2086 " Weird long file name was going over the end of NameBuff
5e65d802bd52 patch 8.2.4074: going over the end of NameBuff
Bram Moolenaar <Bram@vim.org>
parents: 26921
diff changeset
2087 func Test_edit_overlong_file_name()
5e65d802bd52 patch 8.2.4074: going over the end of NameBuff
Bram Moolenaar <Bram@vim.org>
parents: 26921
diff changeset
2088 CheckUnix
5e65d802bd52 patch 8.2.4074: going over the end of NameBuff
Bram Moolenaar <Bram@vim.org>
parents: 26921
diff changeset
2089
5e65d802bd52 patch 8.2.4074: going over the end of NameBuff
Bram Moolenaar <Bram@vim.org>
parents: 26921
diff changeset
2090 file 0000000000000000000000000000
5e65d802bd52 patch 8.2.4074: going over the end of NameBuff
Bram Moolenaar <Bram@vim.org>
parents: 26921
diff changeset
2091 file %%%%%%%%%%%%%%%%%%%%%%%%%%
5e65d802bd52 patch 8.2.4074: going over the end of NameBuff
Bram Moolenaar <Bram@vim.org>
parents: 26921
diff changeset
2092 file %%%%%%
5e65d802bd52 patch 8.2.4074: going over the end of NameBuff
Bram Moolenaar <Bram@vim.org>
parents: 26921
diff changeset
2093 set readonly
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 31821
diff changeset
2094 set ls=2
27090
5e65d802bd52 patch 8.2.4074: going over the end of NameBuff
Bram Moolenaar <Bram@vim.org>
parents: 26921
diff changeset
2095
5e65d802bd52 patch 8.2.4074: going over the end of NameBuff
Bram Moolenaar <Bram@vim.org>
parents: 26921
diff changeset
2096 redraw!
5e65d802bd52 patch 8.2.4074: going over the end of NameBuff
Bram Moolenaar <Bram@vim.org>
parents: 26921
diff changeset
2097 set noreadonly ls&
5e65d802bd52 patch 8.2.4074: going over the end of NameBuff
Bram Moolenaar <Bram@vim.org>
parents: 26921
diff changeset
2098 bwipe!
5e65d802bd52 patch 8.2.4074: going over the end of NameBuff
Bram Moolenaar <Bram@vim.org>
parents: 26921
diff changeset
2099 endfunc
5e65d802bd52 patch 8.2.4074: going over the end of NameBuff
Bram Moolenaar <Bram@vim.org>
parents: 26921
diff changeset
2100
28704
e1aff2f300be patch 8.2.4876: MS-Windows: Shift-BS results in strange char in powershell
Bram Moolenaar <Bram@vim.org>
parents: 28371
diff changeset
2101 func Test_edit_shift_bs()
e1aff2f300be patch 8.2.4876: MS-Windows: Shift-BS results in strange char in powershell
Bram Moolenaar <Bram@vim.org>
parents: 28371
diff changeset
2102 CheckMSWindows
e1aff2f300be patch 8.2.4876: MS-Windows: Shift-BS results in strange char in powershell
Bram Moolenaar <Bram@vim.org>
parents: 28371
diff changeset
2103
e1aff2f300be patch 8.2.4876: MS-Windows: Shift-BS results in strange char in powershell
Bram Moolenaar <Bram@vim.org>
parents: 28371
diff changeset
2104 " FIXME: this works interactively, but the test fails
e1aff2f300be patch 8.2.4876: MS-Windows: Shift-BS results in strange char in powershell
Bram Moolenaar <Bram@vim.org>
parents: 28371
diff changeset
2105 throw 'Skipped: Shift-Backspace Test not working correctly :('
e1aff2f300be patch 8.2.4876: MS-Windows: Shift-BS results in strange char in powershell
Bram Moolenaar <Bram@vim.org>
parents: 28371
diff changeset
2106
e1aff2f300be patch 8.2.4876: MS-Windows: Shift-BS results in strange char in powershell
Bram Moolenaar <Bram@vim.org>
parents: 28371
diff changeset
2107 " Need to run this in Win32 Terminal, do not use CheckRunVimInTerminal
e1aff2f300be patch 8.2.4876: MS-Windows: Shift-BS results in strange char in powershell
Bram Moolenaar <Bram@vim.org>
parents: 28371
diff changeset
2108 if !has("terminal")
e1aff2f300be patch 8.2.4876: MS-Windows: Shift-BS results in strange char in powershell
Bram Moolenaar <Bram@vim.org>
parents: 28371
diff changeset
2109 return
e1aff2f300be patch 8.2.4876: MS-Windows: Shift-BS results in strange char in powershell
Bram Moolenaar <Bram@vim.org>
parents: 28371
diff changeset
2110 endif
e1aff2f300be patch 8.2.4876: MS-Windows: Shift-BS results in strange char in powershell
Bram Moolenaar <Bram@vim.org>
parents: 28371
diff changeset
2111
e1aff2f300be patch 8.2.4876: MS-Windows: Shift-BS results in strange char in powershell
Bram Moolenaar <Bram@vim.org>
parents: 28371
diff changeset
2112 " Shift Backspace should work like Backspace in insert mode
e1aff2f300be patch 8.2.4876: MS-Windows: Shift-BS results in strange char in powershell
Bram Moolenaar <Bram@vim.org>
parents: 28371
diff changeset
2113 let lines =<< trim END
e1aff2f300be patch 8.2.4876: MS-Windows: Shift-BS results in strange char in powershell
Bram Moolenaar <Bram@vim.org>
parents: 28371
diff changeset
2114 call setline(1, ['abc'])
e1aff2f300be patch 8.2.4876: MS-Windows: Shift-BS results in strange char in powershell
Bram Moolenaar <Bram@vim.org>
parents: 28371
diff changeset
2115 END
30393
409ddc3fa5ce patch 9.0.0532: edit test is flaky when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
2116 call writefile(lines, 'Xtest_edit_shift_bs', 'D')
28704
e1aff2f300be patch 8.2.4876: MS-Windows: Shift-BS results in strange char in powershell
Bram Moolenaar <Bram@vim.org>
parents: 28371
diff changeset
2117
e1aff2f300be patch 8.2.4876: MS-Windows: Shift-BS results in strange char in powershell
Bram Moolenaar <Bram@vim.org>
parents: 28371
diff changeset
2118 let buf = RunVimInTerminal('-S Xtest_edit_shift_bs', #{rows: 3})
e1aff2f300be patch 8.2.4876: MS-Windows: Shift-BS results in strange char in powershell
Bram Moolenaar <Bram@vim.org>
parents: 28371
diff changeset
2119 call term_sendkeys(buf, "A\<S-BS>-\<esc>")
e1aff2f300be patch 8.2.4876: MS-Windows: Shift-BS results in strange char in powershell
Bram Moolenaar <Bram@vim.org>
parents: 28371
diff changeset
2120 call TermWait(buf, 50)
e1aff2f300be patch 8.2.4876: MS-Windows: Shift-BS results in strange char in powershell
Bram Moolenaar <Bram@vim.org>
parents: 28371
diff changeset
2121 call assert_equal('ab-', term_getline(buf, 1))
e1aff2f300be patch 8.2.4876: MS-Windows: Shift-BS results in strange char in powershell
Bram Moolenaar <Bram@vim.org>
parents: 28371
diff changeset
2122
e1aff2f300be patch 8.2.4876: MS-Windows: Shift-BS results in strange char in powershell
Bram Moolenaar <Bram@vim.org>
parents: 28371
diff changeset
2123 " clean up
e1aff2f300be patch 8.2.4876: MS-Windows: Shift-BS results in strange char in powershell
Bram Moolenaar <Bram@vim.org>
parents: 28371
diff changeset
2124 call StopVimInTerminal(buf)
e1aff2f300be patch 8.2.4876: MS-Windows: Shift-BS results in strange char in powershell
Bram Moolenaar <Bram@vim.org>
parents: 28371
diff changeset
2125 endfunc
26067
6a55d46e83cd patch 8.2.3567: CTRL-I in Insert mode is not tested
Bram Moolenaar <Bram@vim.org>
parents: 26042
diff changeset
2126
34148
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2127 func Test_edit_Ctrl_RSB()
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2128 new
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2129 let g:triggered = []
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2130 autocmd InsertCharPre <buffer> let g:triggered += [v:char]
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2131
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2132 " i_CTRL-] should not trigger InsertCharPre
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2133 exe "normal! A\<C-]>"
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2134 call assert_equal([], g:triggered)
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2135
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2136 " i_CTRL-] should expand abbreviations but not trigger InsertCharPre
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2137 inoreabbr <buffer> f foo
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2138 exe "normal! Af\<C-]>a"
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2139 call assert_equal(['f', 'f', 'o', 'o', 'a'], g:triggered)
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2140 call assert_equal('fooa', getline(1))
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2141
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2142 " CTRL-] followed by i_CTRL-V should not expand abbreviations
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2143 " i_CTRL-V doesn't trigger InsertCharPre
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2144 call setline(1, '')
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2145 exe "normal! Af\<C-V>\<C-]>"
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2146 call assert_equal("f\<C-]>", getline(1))
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2147
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2148 let g:triggered = []
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2149 call setline(1, '')
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2150
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2151 " Also test assigning to v:char
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2152 autocmd InsertCharPre <buffer> let v:char = 'f'
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2153 exe "normal! Ag\<C-]>h"
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2154 call assert_equal(['g', 'f', 'o', 'o', 'h'], g:triggered)
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2155 call assert_equal('ffff', getline(1))
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2156
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2157 autocmd! InsertCharPre
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2158 unlet g:triggered
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2159 bwipe!
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2160 endfunc
8687845c326c patch 9.1.0035: i_CTRL-] triggers InsertCharPre
Christian Brabandt <cb@256bit.org>
parents: 33223
diff changeset
2161
34636
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2162 func s:check_backspace(expected)
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2163 let g:actual = []
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2164 inoremap <buffer> <F2> <Cmd>let g:actual += [getline('.')]<CR>
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2165 set backspace=indent,eol,start
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2166
34674
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2167 exe "normal i" .. repeat("\<BS>\<F2>", len(a:expected))
34636
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2168 call assert_equal(a:expected, g:actual)
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2169
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2170 set backspace&
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2171 iunmap <buffer> <F2>
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2172 unlet g:actual
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2173 endfunc
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2174
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2175 " Test that backspace works with 'smarttab' and mixed Tabs and spaces.
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2176 func Test_edit_backspace_smarttab_mixed()
34674
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2177 set smarttab
34636
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2178 call NewWindow(1, 30)
34674
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2179 setlocal tabstop=4 shiftwidth=4
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2180
34636
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2181 call setline(1, "\t \t \t a")
34674
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2182 normal! $
34636
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2183 call s:check_backspace([
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2184 \ "\t \t \ta",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2185 \ "\t \t a",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2186 \ "\t \t a",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2187 \ "\t \ta",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2188 \ "\t a",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2189 \ "\ta",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2190 \ "a",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2191 \ ])
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2192
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2193 call CloseWindow()
34674
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2194 set smarttab&
34636
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2195 endfunc
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2196
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2197 " Test that backspace works with 'smarttab' and 'varsofttabstop'.
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2198 func Test_edit_backspace_smarttab_varsofttabstop()
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2199 CheckFeature vartabs
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2200
34674
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2201 set smarttab
34636
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2202 call NewWindow(1, 30)
34674
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2203 setlocal tabstop=8 varsofttabstop=6,2,5,3
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2204
34636
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2205 call setline(1, "a\t \t a")
34674
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2206 normal! $
34636
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2207 call s:check_backspace([
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2208 \ "a\t \ta",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2209 \ "a\t a",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2210 \ "a\ta",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2211 \ "a a",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2212 \ "aa",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2213 \ "a",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2214 \ ])
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2215
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2216 call CloseWindow()
34674
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2217 set smarttab&
34636
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2218 endfunc
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2219
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2220 " Test that backspace works with 'smarttab' when a Tab is shown as "^I".
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2221 func Test_edit_backspace_smarttab_list()
34674
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2222 set smarttab
34636
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2223 call NewWindow(1, 30)
34674
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2224 setlocal tabstop=4 shiftwidth=4 list listchars=
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2225
34636
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2226 call setline(1, "\t \t \t a")
34674
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2227 normal! $
34636
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2228 call s:check_backspace([
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2229 \ "\t \t a",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2230 \ "\t \t a",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2231 \ "\t \ta",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2232 \ "\t a",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2233 \ "a",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2234 \ ])
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2235
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2236 call CloseWindow()
34674
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2237 set smarttab&
34636
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2238 endfunc
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2239
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2240 " Test that backspace works with 'smarttab' and 'breakindent'.
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2241 func Test_edit_backspace_smarttab_breakindent()
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2242 CheckFeature linebreak
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2243
34674
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2244 set smarttab
34636
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2245 call NewWindow(3, 17)
34674
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2246 setlocal tabstop=4 shiftwidth=4 breakindent breakindentopt=min:5
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2247
34636
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2248 call setline(1, "\t \t \t a")
34674
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2249 normal! $
34636
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2250 call s:check_backspace([
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2251 \ "\t \t \ta",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2252 \ "\t \t a",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2253 \ "\t \t a",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2254 \ "\t \ta",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2255 \ "\t a",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2256 \ "\ta",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2257 \ "a",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2258 \ ])
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2259
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2260 call CloseWindow()
34674
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2261 set smarttab&
34636
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2262 endfunc
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2263
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2264 " Test that backspace works with 'smarttab' and virtual text.
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2265 func Test_edit_backspace_smarttab_virtual_text()
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2266 CheckFeature textprop
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2267
34674
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2268 set smarttab
34636
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2269 call NewWindow(1, 50)
34674
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2270 setlocal tabstop=4 shiftwidth=4
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2271
34636
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2272 call setline(1, "\t \t \t a")
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2273 call prop_type_add('theprop', {})
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2274 call prop_add(1, 3, {'type': 'theprop', 'text': 'text'})
34674
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2275 normal! $
34636
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2276 call s:check_backspace([
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2277 \ "\t \t \ta",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2278 \ "\t \t a",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2279 \ "\t \t a",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2280 \ "\t \ta",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2281 \ "\t a",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2282 \ "\ta",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2283 \ "a",
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2284 \ ])
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2285
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2286 call CloseWindow()
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2287 call prop_type_delete('theprop')
34674
bfd2c0032686 patch 9.1.0218: Unnecessary multiplications in backspace code
Christian Brabandt <cb@256bit.org>
parents: 34665
diff changeset
2288 set smarttab&
34636
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2289 endfunc
c94ef9458309 patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'
Christian Brabandt <cb@256bit.org>
parents: 34148
diff changeset
2290
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
2291 " vim: shiftwidth=2 sts=2 expandtab