Mercurial > vim
annotate src/testdir/test_edit.vim @ 25326:cfbf40f749b0 v8.2.3200
patch 8.2.3200: Vim9: hard to guess where a type error is given
Commit: https://github.com/vim/vim/commit/7a3fe3e180bdbce8f193abdf399559c5154bdaae
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jul 22 14:58:47 2021 +0200
patch 8.2.3200: Vim9: hard to guess where a type error is given
Problem: Vim9: hard to guess where a type error is given.
Solution: Add the function name where possible. (closes https://github.com/vim/vim/issues/8608)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 22 Jul 2021 15:00:05 +0200 |
parents | 4c1b6f3eb96b |
children | ec62e0764ffa |
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 |
c4d97a18af37
patch 8.1.2263: 'noesckeys' test fails in GUI
Bram Moolenaar <Bram@vim.org>
parents:
18534
diff
changeset
|
8 |
11105
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 " Needed for testing basic rightleft: Test_edit_rightleft |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 source view_util.vim |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 " 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
|
13 " 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
|
14 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
|
15 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 call setline(1, ['abc ']) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 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
|
18 call cursor(1, 4) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 " <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
|
20 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
|
21 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
|
22 iunabbr <buffer> h |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
26 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
|
27 " set for Travis CI? |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 " set nocp noesckeys |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 " 1) empty buffer |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 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
|
32 " 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
|
33 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
|
34 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
|
35 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 " 3) delete one character |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 call setline(1, 'a') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 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
|
39 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
|
40 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 " 4) delete a multibyte character |
15607
2dcaa860e3fc
patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
42 call setline(1, "\u0401") |
2dcaa860e3fc
patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
43 call feedkeys("i\<del>\<esc>", 'tnix') |
2dcaa860e3fc
patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
44 call assert_equal([''], getline(1,'$')) |
2dcaa860e3fc
patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
45 %d |
11105
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 " 5.1) delete linebreak with 'bs' option containing eol |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 let _bs=&bs |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 set bs=eol |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 call setline(1, ["abc def", "ghi jkl"]) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 call feedkeys("A\<del>\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 call assert_equal(['abc defghi jkl'], getline(1, 2)) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 " 5.2) delete linebreak with backspace option w/out eol |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 set bs= |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 call setline(1, ["abc def", "ghi jkl"]) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 call feedkeys("A\<del>\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 call assert_equal(["abc def", "ghi jkl"], getline(1, 2)) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 let &bs=_bs |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
64 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
|
65 " Change cursor position in InsertCharPre command |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 call setline(1, 'abc') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 fu! DoIt(...) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 call cursor(1, 4) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
71 if len(a:000) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 let v:char=a:1 |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 endif |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 endfu |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 au InsertCharPre <buffer> :call DoIt('y') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
76 call feedkeys("ix\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 call assert_equal(['abcy'], getline(1, '$')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 " Setting <Enter> in InsertCharPre |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 au! InsertCharPre <buffer> :call DoIt("\n") |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 call setline(1, 'abc') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 call feedkeys("ix\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
83 call assert_equal(['abc', ''], getline(1, '$')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
84 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
85 au! InsertCharPre |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
86 " Change cursor position in InsertEnter command |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 " 1) when setting v:char, keeps changed cursor position |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 au! InsertEnter <buffer> :call DoIt('y') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
89 call setline(1, 'abc') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
90 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
91 call feedkeys("ix\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
92 call assert_equal(['abxc'], getline(1, '$')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
93 " 2) when not setting v:char, restores changed cursor position |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
94 au! InsertEnter <buffer> :call DoIt() |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
95 call setline(1, 'abc') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
96 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
97 call feedkeys("ix\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
98 call assert_equal(['xabc'], getline(1, '$')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
99 au! InsertEnter |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
100 delfu DoIt |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
101 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
102 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
103 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
104 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
|
105 " Change cursor after <c-o> command to end of line |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
106 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
107 call setline(1, 'abc') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
108 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
109 call feedkeys("i\<c-o>$y\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
110 call assert_equal(['abcy'], getline(1, '$')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
111 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
112 call setline(1, 'abc') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
113 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
114 call feedkeys("i\<c-o>80|y\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
115 call assert_equal(['abcy'], getline(1, '$')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
116 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
117 call setline(1, 'abc') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
118 call feedkeys("Ad\<c-o>:s/$/efg/\<cr>hij", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
119 call assert_equal(['hijabcdefg'], getline(1, '$')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
120 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
121 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
122 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
123 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
|
124 " test for :stopinsert |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
125 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
126 call setline(1, 'abc') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
127 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
128 call feedkeys("i\<c-o>:stopinsert\<cr>$", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
129 call feedkeys("aX\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
130 call assert_equal(['abcX'], getline(1, '$')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
131 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
132 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
133 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
134 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
135 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
|
136 " test for folds being opened |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
137 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
138 call setline(1, ['abcX', 'abcX', 'zzzZ']) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
139 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
140 set foldmethod=manual foldopen+=insert |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
141 " create fold for those two lines |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
142 norm! Vjzf |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
143 call feedkeys("$ay\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
144 call assert_equal(['abcXy', 'abcX', 'zzzZ'], getline(1, '$')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
145 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
146 call setline(1, ['abcX', 'abcX', 'zzzZ']) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
147 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
148 set foldmethod=manual foldopen-=insert |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
149 " create fold for those two lines |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
150 norm! Vjzf |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
151 call feedkeys("$ay\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
152 call assert_equal(['abcXy', 'abcX', 'zzzZ'], getline(1, '$')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
153 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
154 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
155 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
156 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
157 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
|
158 " Test in diff mode |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21580
diff
changeset
|
159 CheckFeature diff |
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21580
diff
changeset
|
160 CheckExecutable diff |
11105
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
161 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
162 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
|
163 vnew |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
164 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
|
165 wincmd p |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
166 diffthis |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
167 wincmd p |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
168 diffthis |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
169 wincmd p |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
170 call cursor(2, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
171 norm! zt |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
172 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
|
173 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
|
174 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
175 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
176 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
177 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
178 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
|
179 " 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
|
180 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
181 call setline(1, 'J') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
182 |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
183 func! ListMonths() |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
184 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
|
185 \ '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
|
186 \ 'October', 'November', 'December']) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
187 return '' |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
188 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
189 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
|
190 |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
191 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
|
192 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
|
193 " 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
|
194 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
195 call setline(1, 'J') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
196 fu! DoIt() |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
197 if v:char=='u' |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
198 let v:char='an' |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
199 endif |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
200 endfu |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
201 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
|
202 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
|
203 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
|
204 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
205 call setline(1, 'J') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
206 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
|
207 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
|
208 |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
209 delfu ListMonths |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
210 delfu DoIt |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
211 iunmap <buffer> <f5> |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
212 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
213 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
214 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
215 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
|
216 " 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
|
217 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
|
218 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
219 call setline(1, ['abc']) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
220 call cursor(1, 4) |
12696
6daad7ef16be
patch 8.0.1226: edit and popup tests failing
Christian Brabandt <cb@256bit.org>
parents:
12654
diff
changeset
|
221 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
|
222 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
|
223 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
|
224 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
|
225 bw! |
12696
6daad7ef16be
patch 8.0.1226: edit and popup tests failing
Christian Brabandt <cb@256bit.org>
parents:
12654
diff
changeset
|
226 unlet g:bufnr |
11105
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
227 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
228 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
229 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
|
230 " test i_CTRL-\ combinations |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
231 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
232 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
|
233 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
234 " 1) CTRL-\ CTLR-N |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
235 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
|
236 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
|
237 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
|
238 " 2) CTRL-\ CTLR-G |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
239 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
|
240 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
|
241 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
|
242 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
|
243 set noinsertmode |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
244 " 3) CTRL-\ CTRL-O |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
245 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
|
246 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
247 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
|
248 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
|
249 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
|
250 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
|
251 " 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
|
252 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
|
253 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
254 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
|
255 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
|
256 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
257 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
258 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
259 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
|
260 " 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
|
261 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
262 set cindent |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
263 call setline(1, ['{', '', '']) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
264 call cursor(2, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
265 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
|
266 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
|
267 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
|
268 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
|
269 " added changed cindentkeys slightly |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
270 set cindent cinkeys+=*/ |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
271 call setline(1, ['{', '', '']) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
272 call cursor(2, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
273 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
|
274 call cursor(3, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
275 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
|
276 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
|
277 set cindent cinkeys+==end |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
278 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
|
279 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
|
280 set cinkeys-==end |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
281 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
282 " 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
|
283 func! Do_Indent() |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
284 if v:lnum == 3 |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
285 return 3*shiftwidth() |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
286 else |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
287 return 2*shiftwidth() |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
288 endif |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
289 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
290 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
|
291 call setline(1, ['{', '', '']) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
292 call cursor(2, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
293 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
|
294 call cursor(3, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
295 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
|
296 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
|
297 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
|
298 set nocindent indentexpr= |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
299 delfu Do_Indent |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
300 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
301 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
302 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
303 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
|
304 " Test that indenting kicks in |
a69d3595d773
patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11319
diff
changeset
|
305 new |
a69d3595d773
patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11319
diff
changeset
|
306 " Use indentexpr instead of cindenting |
a69d3595d773
patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11319
diff
changeset
|
307 func! Do_Indent() |
a69d3595d773
patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11319
diff
changeset
|
308 let pline=prevnonblank(v:lnum) |
a69d3595d773
patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11319
diff
changeset
|
309 if empty(getline(v:lnum)) |
a69d3595d773
patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11319
diff
changeset
|
310 if getline(pline) =~ 'if\|then' |
a69d3595d773
patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11319
diff
changeset
|
311 return shiftwidth() |
a69d3595d773
patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11319
diff
changeset
|
312 else |
a69d3595d773
patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11319
diff
changeset
|
313 return 0 |
a69d3595d773
patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11319
diff
changeset
|
314 endif |
a69d3595d773
patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11319
diff
changeset
|
315 else |
a69d3595d773
patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11319
diff
changeset
|
316 return 0 |
a69d3595d773
patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11319
diff
changeset
|
317 endif |
a69d3595d773
patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11319
diff
changeset
|
318 endfunc |
a69d3595d773
patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11319
diff
changeset
|
319 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
|
320 call setline(1, ['if [ $this ]']) |
a69d3595d773
patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11319
diff
changeset
|
321 call cursor(1, 1) |
a69d3595d773
patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11319
diff
changeset
|
322 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
|
323 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
|
324 set cinkeys&vim indentkeys&vim |
a69d3595d773
patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11319
diff
changeset
|
325 set nocindent indentexpr= |
a69d3595d773
patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11319
diff
changeset
|
326 delfu Do_Indent |
a69d3595d773
patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11319
diff
changeset
|
327 bw! |
a69d3595d773
patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11319
diff
changeset
|
328 endfunc |
a69d3595d773
patch 8.0.1154: 'indentkeys' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11319
diff
changeset
|
329 |
20285
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
330 " 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
|
331 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
|
332 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
333 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
|
334 call cursor(2, 4) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
335 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
|
336 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
|
337 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
|
338 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
339 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
|
340 call cursor(2, 2) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
341 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
|
342 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
|
343 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
|
344 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
345 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
|
346 call cursor(2, 2) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
347 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
|
348 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
|
349 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
|
350 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
351 10vnew |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
352 call setline(1, ["\tabc", "\t\tdef"]) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
353 call cursor(2, 2) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
354 call feedkeys("R\<c-t>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
355 call assert_equal(["\tabc", "\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
|
356 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
|
357 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
358 set sw=4 |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
359 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
|
360 call cursor(2, 2) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
361 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
|
362 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
|
363 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
|
364 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
365 call setline(1, ["\tabc", "\t\tdef"]) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
366 call cursor(2, 2) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
367 call feedkeys("R\<c-t>\<c-t>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
368 call assert_equal(["\tabc", "\t\t\tdef"], getline(1, '$')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
369 call assert_equal([0, 2, 2, 0], getpos('.')) |
20285
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
370 set sw& |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
371 |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
372 " 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
|
373 " 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
|
374 %d |
20285
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
375 setlocal autoindent backspace=2 |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
376 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
|
377 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
|
378 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
|
379 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
380 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
381 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
382 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
|
383 " Test smartindenting |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
384 if exists("+smartindent") |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
385 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
386 set smartindent autoindent |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
387 call setline(1, ["\tabc"]) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
388 call feedkeys("A {\<cr>more\<cr>}\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
389 call assert_equal(["\tabc {", "\t\tmore", "\t}"], getline(1, '$')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
390 set smartindent& autoindent& |
16011
de810c9651c8
patch 8.1.1011: indent from autoindent not removed from blank line
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
391 bwipe! |
11105
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
392 endif |
16011
de810c9651c8
patch 8.1.1011: indent from autoindent not removed from blank line
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
393 |
de810c9651c8
patch 8.1.1011: indent from autoindent not removed from blank line
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
394 " 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
|
395 new |
de810c9651c8
patch 8.1.1011: indent from autoindent not removed from blank line
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
396 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
|
397 set autoindent |
de810c9651c8
patch 8.1.1011: indent from autoindent not removed from blank line
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
398 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
|
399 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
|
400 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
|
401 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
|
402 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
|
403 |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
404 " 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
|
405 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
|
406 %d |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
407 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
|
408 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
|
409 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
|
410 |
16011
de810c9651c8
patch 8.1.1011: indent from autoindent not removed from blank line
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
411 bwipe! |
11105
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
412 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
413 |
24204
ec71c859e94c
patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24164
diff
changeset
|
414 " 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
|
415 " 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
|
416 " terminal. |
ec71c859e94c
patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24164
diff
changeset
|
417 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
|
418 CheckRunVimInTerminal |
ec71c859e94c
patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24164
diff
changeset
|
419 let buf = RunVimInTerminal('-N Xfile', {'rows': 6, 'cols' : 20}) |
ec71c859e94c
patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24164
diff
changeset
|
420 call TermWait(buf) |
ec71c859e94c
patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24164
diff
changeset
|
421 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
|
422 " 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
|
423 " remove the indent. |
ec71c859e94c
patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24164
diff
changeset
|
424 call term_sendkeys(buf, "i\<Tab>foo\<CR>\<Esc>") |
ec71c859e94c
patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24164
diff
changeset
|
425 " Need to delay for sometime, otherwise the code in getchar.c will not be |
ec71c859e94c
patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24164
diff
changeset
|
426 " exercised. |
ec71c859e94c
patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24164
diff
changeset
|
427 call TermWait(buf, 50) |
ec71c859e94c
patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24164
diff
changeset
|
428 " 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
|
429 " 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
|
430 call term_sendkeys(buf, "o" .. repeat('x', 20) .. "\<Esc>") |
ec71c859e94c
patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24164
diff
changeset
|
431 " Need to delay for sometime, otherwise the code in getchar.c will not be |
ec71c859e94c
patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24164
diff
changeset
|
432 " exercised. |
ec71c859e94c
patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24164
diff
changeset
|
433 call TermWait(buf, 50) |
ec71c859e94c
patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24164
diff
changeset
|
434 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
|
435 call TermWait(buf) |
ec71c859e94c
patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24164
diff
changeset
|
436 call StopVimInTerminal(buf) |
ec71c859e94c
patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24164
diff
changeset
|
437 call assert_equal(["\tfoo", '', repeat('x', 20)], readfile('Xfile')) |
ec71c859e94c
patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24164
diff
changeset
|
438 call delete('Xfile') |
ec71c859e94c
patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24164
diff
changeset
|
439 endfunc |
ec71c859e94c
patch 8.2.2643: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24164
diff
changeset
|
440 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
441 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
|
442 " Test for <CR> in insert mode |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
443 " basically only in quickfix mode ist tested, the rest |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
444 " 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
|
445 CheckFeature quickfix |
11105
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
446 botright new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
447 call writefile(range(1, 10), 'Xqflist.txt') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
448 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
|
449 copen |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
450 set modifiable |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
451 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
|
452 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
|
453 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
|
454 cclose |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
455 botright new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
456 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
|
457 lopen |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
458 set modifiable |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
459 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
|
460 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
|
461 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
|
462 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
|
463 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
|
464 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
|
465 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
|
466 call assert_equal(map(range(1, 10), 'string(v:val)') + ['', '', '', ''], getline(1, '$')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
467 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
468 lclose |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
469 call delete('Xqflist.txt') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
470 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
471 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
472 func Test_edit_CTRL_() |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21580
diff
changeset
|
473 CheckFeature rightleft |
11105
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
474 " 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
|
475 CheckNotMSWindows |
11105
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
476 let _encoding=&encoding |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
477 set encoding=utf-8 |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
478 " Test for CTRL-_ |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
479 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
480 call setline(1, ['abc']) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
481 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
482 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
|
483 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
|
484 call assert_false(&revins) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
485 set ari |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
486 call setline(1, ['abc']) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
487 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
488 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
|
489 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
|
490 call assert_true(&revins) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
491 call setline(1, ['abc']) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
492 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
493 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
|
494 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
|
495 call assert_false(&revins) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
496 set noari |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
497 let &encoding=_encoding |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
498 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
499 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
500 |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
501 " 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
|
502 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
|
503 " Test pressing CTRL-A |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
504 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
505 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
|
506 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
507 try |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
508 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
|
509 catch /^Vim\%((\a\+)\)\=:E29/ |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
510 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
|
511 endtry |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
512 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
513 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
|
514 call cursor(2, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
515 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
|
516 call cursor(3, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
517 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
|
518 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
|
519 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
520 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
521 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
522 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
|
523 " 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
|
524 10new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
525 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
|
526 call cursor(30, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
527 norm! z. |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
528 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
|
529 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
|
530 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
|
531 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
|
532 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
|
533 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
|
534 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
|
535 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
536 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
537 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
538 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
|
539 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
540 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
|
541 call cursor(2, 4) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
542 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
|
543 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
|
544 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
|
545 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
|
546 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
|
547 call cursor(2, 4) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
548 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
|
549 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
|
550 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
|
551 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
|
552 call assert_equal([0, 3, 6, 0], getpos('.')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
553 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
554 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
555 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
556 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
|
557 " Tab in completion mode |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
558 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
|
559 new |
14039
acb2dc112b06
patch 8.1.0037: cannot easily append lines to another buffer
Christian Brabandt <cb@256bit.org>
parents:
14033
diff
changeset
|
560 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
|
561 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
|
562 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
|
563 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
564 call writefile(['one', 'two', 'three'], 'Xinclude.txt') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
565 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
|
566 call setline(1, [include, '']) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
567 call cursor(2, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
568 call feedkeys("A\<c-x>\<tab>\<cr>\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
569 call assert_equal([include, 'one', ''], getline(1, '$')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
570 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
|
571 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
|
572 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
|
573 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
|
574 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
|
575 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
|
576 call delete("Xinclude.txt") |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
577 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
578 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
579 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
580 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
|
581 " 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
|
582 " 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
|
583 call writefile(['A', 'AA', 'AAA', 'AAAA'], 'Xdictionary.txt') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
584 set dictionary=Xdictionary.txt |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
585 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
586 call setline(1, 'A') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
587 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
588 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
|
589 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
|
590 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
591 call setline(1, 'A') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
592 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
593 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
|
594 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
|
595 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
596 call setline(1, 'A') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
597 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
598 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
|
599 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
|
600 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
601 call setline(1, 'A') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
602 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
603 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
|
604 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
|
605 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
606 call setline(1, 'A') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
607 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
608 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
|
609 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
|
610 |
19195
2ef19eed524a
patch 8.2.0156: various typos in source files and tests
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
611 " 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
|
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>\<c-]>\<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(['AA', ''], 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>\<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
|
621 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
|
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>\<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
|
626 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
|
627 |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
628 set dictionary= |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
629 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
630 call setline(1, 'A') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
631 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
632 let v:testing = 1 |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
633 try |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
634 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
|
635 catch |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
636 " 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
|
637 let v:testing = 0 |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
638 endtry |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
639 call delete('Xdictionary.txt') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
640 |
15607
2dcaa860e3fc
patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
641 call test_override("char_avail", 1) |
2dcaa860e3fc
patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
642 set showcmd |
2dcaa860e3fc
patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
643 %d |
2dcaa860e3fc
patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
644 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
|
645 call assert_equal(['ä'], getline(1, '$')) |
2dcaa860e3fc
patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
646 call test_override("char_avail", 0) |
2dcaa860e3fc
patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
647 set noshowcmd |
2dcaa860e3fc
patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
648 |
11105
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
649 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
650 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
651 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
652 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
|
653 " 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
|
654 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
655 set complete=. |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
656 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
|
657 call cursor(4, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
658 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
|
659 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
|
660 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
|
661 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
|
662 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
|
663 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
|
664 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
|
665 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
|
666 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
|
667 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
|
668 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
|
669 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
|
670 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
|
671 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
|
672 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
|
673 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
|
674 set complete= |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
675 call cursor(5, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
676 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
|
677 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
|
678 set complete& |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
679 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
680 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
|
681 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
|
682 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
|
683 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
|
684 syn on |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
685 syn match ErrorMsg "^bar" |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
686 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
|
687 func! DoIt() |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
688 let g:change=1 |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
689 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
690 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
|
691 |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
692 call cursor(2, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
693 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
|
694 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
|
695 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
|
696 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
|
697 |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
698 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
|
699 call clearmatches() |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
700 syn off |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
701 au! TextChangedI |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
702 delfu DoIt |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
703 unlet! g:change |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
704 endif |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
705 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
706 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
707 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
708 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
|
709 " Check keyword completion |
23984
e27b5529dc6a
patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents:
22724
diff
changeset
|
710 for e in ['latin1', 'utf-8'] |
e27b5529dc6a
patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents:
22724
diff
changeset
|
711 exe 'set encoding=' .. e |
e27b5529dc6a
patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents:
22724
diff
changeset
|
712 new |
e27b5529dc6a
patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents:
22724
diff
changeset
|
713 set complete=. |
e27b5529dc6a
patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents:
22724
diff
changeset
|
714 call setline(1, ['INFER', 'loWER', '', '', ]) |
e27b5529dc6a
patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents:
22724
diff
changeset
|
715 call cursor(3, 1) |
e27b5529dc6a
patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents:
22724
diff
changeset
|
716 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
|
717 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
|
718 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
|
719 %d |
e27b5529dc6a
patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents:
22724
diff
changeset
|
720 call setline(1, ['INFER', 'loWER', '', '', ]) |
e27b5529dc6a
patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents:
22724
diff
changeset
|
721 call cursor(3, 1) |
e27b5529dc6a
patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents:
22724
diff
changeset
|
722 set ignorecase infercase |
e27b5529dc6a
patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents:
22724
diff
changeset
|
723 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
|
724 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
|
725 call assert_equal(['INFER', 'loWER', 'infer', 'LOWER', '', ''], getline(1, '$'), e) |
11105
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
726 |
23984
e27b5529dc6a
patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents:
22724
diff
changeset
|
727 set noignorecase noinfercase complete& |
e27b5529dc6a
patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents:
22724
diff
changeset
|
728 bw! |
e27b5529dc6a
patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents:
22724
diff
changeset
|
729 endfor |
11105
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
730 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
731 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
732 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
|
733 " 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
|
734 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
735 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
|
736 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
|
737 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
738 " 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
|
739 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
|
740 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
|
741 call assert_true(&nu) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
742 set nonu |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
743 iunabbr <buffer> h |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
744 " 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
|
745 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
746 call feedkeys("A\<c-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
|
747 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
|
748 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
749 set ve=onemore |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
750 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
|
751 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
|
752 set ve= |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
753 unlet! g:a |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
754 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
755 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
756 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
757 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
|
758 " Insert Register |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
759 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
760 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
|
761 set showcmd |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
762 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
|
763 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
|
764 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
|
765 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
|
766 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
|
767 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
|
768 set noshowcmd |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
769 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
770 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
771 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
772 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
|
773 " 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
|
774 " 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
|
775 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
776 if !has("spell") |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
777 call setline(1, 'vim') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
778 call feedkeys("A\<c-x>ss\<cr>\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
779 call assert_equal(['vims', ''], getline(1, '$')) |
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 return |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
782 endif |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
783 call setline(1, 'vim') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
784 " 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
|
785 try |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
786 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
|
787 catch /^Vim\%((\a\+)\)\=:E756/ |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
788 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
|
789 endtry |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
790 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
|
791 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
792 setl spell spelllang=en |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
793 call setline(1, 'vim') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
794 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
795 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
|
796 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
|
797 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
798 call setline(1, 'vim') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
799 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
800 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
|
801 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
|
802 %d |
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 cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
805 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
|
806 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
|
807 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
808 " empty buffer |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
809 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
810 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
|
811 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
|
812 setl nospell |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
813 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
814 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
815 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
816 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
|
817 " 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
|
818 " 1) increase indent |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
819 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
820 call setline(1, "abc") |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
821 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
822 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
|
823 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
|
824 " 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
|
825 set paste |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
826 call setline(1, "abc") |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
827 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
828 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
|
829 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
|
830 set nopaste |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
831 " CTRL-X CTRL-T (thesaurus complete) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
832 call writefile(['angry furious mad enraged'], 'Xthesaurus') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
833 set thesaurus=Xthesaurus |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
834 call setline(1, 'mad') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
835 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
836 call feedkeys("A\<c-x>\<c-t>\<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(['mad', ''], getline(1, '$')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
838 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
839 call setline(1, 'mad') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
840 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
841 call feedkeys("A\<c-x>\<c-t>\<c-n>\<cr>\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
842 call assert_equal(['angry', ''], getline(1, '$')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
843 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
844 call setline(1, 'mad') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
845 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
846 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
|
847 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
|
848 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
849 call setline(1, 'mad') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
850 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
851 call feedkeys("A\<c-x>\<c-t>\<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
|
852 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
|
853 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
854 call setline(1, 'mad') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
855 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
856 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
|
857 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
|
858 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
859 call setline(1, 'mad') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
860 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
861 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
|
862 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
|
863 " 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
|
864 set complete= |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
865 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
866 call setline(1, 'mad') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
867 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
868 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
|
869 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
|
870 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
871 call setline(1, 'mad') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
872 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
873 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
|
874 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
|
875 set complete& |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
876 |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
877 set thesaurus= |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
878 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
879 call setline(1, 'mad') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
880 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
881 let v:testing = 1 |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
882 try |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
883 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
|
884 catch |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
885 " 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
|
886 let v:testing = 0 |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
887 endtry |
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 call delete('Xthesaurus') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
890 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
891 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
892 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
893 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
|
894 " Test 'completefunc' |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
895 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
896 " -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
|
897 let g:special=0 |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
898 fun! CompleteMonths(findstart, base) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
899 if a:findstart |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
900 " 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
|
901 return g:special |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
902 else |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
903 " 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
|
904 let res = [] |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
905 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
|
906 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
|
907 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
|
908 endif |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
909 endfor |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
910 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
|
911 endif |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
912 endfun |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
913 set completefunc=CompleteMonths |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
914 call setline(1, ['', '']) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
915 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
916 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
|
917 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
|
918 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
919 let g:special=-1 |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
920 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
|
921 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
|
922 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
923 let g:special=-2 |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
924 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
|
925 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
|
926 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
927 let g:special=-3 |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
928 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
|
929 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
|
930 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
931 let g:special=0 |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
932 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
|
933 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
|
934 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
935 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
|
936 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
|
937 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
938 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
|
939 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
|
940 delfu CompleteMonths |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
941 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
942 try |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
943 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
|
944 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
|
945 catch /^Vim\%((\a\+)\)\=:E117/ |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
946 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
|
947 endtry |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
948 set completefunc= |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
949 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
950 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
951 |
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
|
952 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
|
953 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
|
954 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
|
955 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
|
956 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
|
957 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
|
958 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
|
959 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
|
960 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
|
961 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
|
962 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
|
963 2d |
20229
06a1dd50463e
patch 8.2.0670: cannot change window when evaluating 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents:
20187
diff
changeset
|
964 call assert_fails("normal 2G$a\<C-X>\<C-U>", 'E578:') |
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
|
965 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
|
966 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
|
967 |
252d2bb90394
patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
968 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
969 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
|
970 " 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
|
971 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
972 call setline(1, 'abc') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
973 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
|
974 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
|
975 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
976 " 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
|
977 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
978 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
979 func Test_edit_DROP() |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21580
diff
changeset
|
980 CheckFeature dnd |
11105
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
981 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
982 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
|
983 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
984 try |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
985 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
|
986 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
|
987 catch /^Vim\%((\a\+)\)\=:E353/ |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
988 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
|
989 endtry |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
990 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
991 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
992 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
993 func Test_edit_CTRL_V() |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21580
diff
changeset
|
994 CheckFeature ebcdic |
11105
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
995 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
996 call setline(1, ['abc']) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
997 call cursor(2, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
998 " force some redraws |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
999 set showmode showcmd |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1000 "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
|
1001 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
|
1002 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
|
1003 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
|
1004 |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1005 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
|
1006 set rl |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1007 call setline(1, ['abc']) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1008 call cursor(2, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1009 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
|
1010 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
|
1011 set norl |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1012 endif |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1013 |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1014 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
|
1015 set noshowmode showcmd |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1016 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1017 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1018 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
1019 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
|
1020 CheckFeature quickfix |
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18538
diff
changeset
|
1021 |
11105
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1022 " Pressing <f1> |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1023 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1024 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
|
1025 set noinsertmode |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1026 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
|
1027 bw |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1028 bw |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1029 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1030 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
1031 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
|
1032 " Pressing <f21> |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1033 " sends a netbeans command |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21580
diff
changeset
|
1034 CheckFeature netbeans_intg |
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21580
diff
changeset
|
1035 new |
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21580
diff
changeset
|
1036 " 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
|
1037 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
|
1038 bw |
11105
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1039 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1040 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
1041 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
|
1042 " Test Home/End Keys |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1043 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1044 set foldopen+=hor |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1045 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
|
1046 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1047 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
|
1048 call cursor(2, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1049 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
|
1050 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
|
1051 |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1052 set foldopen-=hor |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1053 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1054 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1055 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
1056 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
|
1057 " Test for Pressing <Insert> |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1058 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1059 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
|
1060 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1061 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
|
1062 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
|
1063 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
|
1064 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1065 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
|
1066 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
|
1067 bw! |
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_LEFT_RIGHT() |
11105
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1071 " 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
|
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', '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
|
1074 let _ww=&ww |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1075 set ww= |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1076 call cursor(2, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1077 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
|
1078 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
|
1079 " 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
|
1080 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
|
1081 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
|
1082 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
|
1083 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
|
1084 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
|
1085 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
|
1086 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
|
1087 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
|
1088 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
|
1089 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
|
1090 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
|
1091 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
|
1092 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
|
1093 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
|
1094 call cursor(3, 11) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1095 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
|
1096 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
|
1097 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
|
1098 call cursor(2, 11) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1099 " <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
|
1100 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
|
1101 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
|
1102 " 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
|
1103 set ww+=[,] |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1104 call cursor(2, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1105 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
|
1106 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
|
1107 call cursor(2, 11) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1108 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
|
1109 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
|
1110 call cursor(2, 11) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1111 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
|
1112 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
|
1113 let &ww = _ww |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1114 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1115 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1116 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
1117 func Test_edit_MOUSE() |
11105
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1118 " This is a simple test, since we 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
|
1119 CheckFeature mouse |
11105
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1120 10new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1121 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
|
1122 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1123 set mouse=a |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1124 call feedkeys("A\<ScrollWheelDown>\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1125 call assert_equal([0, 4, 1, 0], getpos('.')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1126 " This should move by one pageDown, but only moves |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1127 " by one line when the test is run... |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1128 call feedkeys("A\<S-ScrollWheelDown>\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1129 call assert_equal([0, 5, 1, 0], getpos('.')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1130 set nostartofline |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1131 call feedkeys("A\<C-ScrollWheelDown>\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1132 call assert_equal([0, 6, 1, 0], getpos('.')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1133 call feedkeys("A\<LeftMouse>\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1134 call assert_equal([0, 6, 1, 0], getpos('.')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1135 call feedkeys("A\<RightMouse>\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1136 call assert_equal([0, 6, 1, 0], getpos('.')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1137 call cursor(1, 100) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1138 norm! zt |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1139 " 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
|
1140 " 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
|
1141 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
|
1142 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
|
1143 call cursor(1, 30) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1144 norm! zt |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1145 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
|
1146 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
|
1147 call cursor(1, 30) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1148 norm! zt |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1149 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
|
1150 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
|
1151 %d |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1152 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
|
1153 call cursor(2, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1154 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
|
1155 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
|
1156 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
|
1157 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
|
1158 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
|
1159 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
|
1160 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
|
1161 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
|
1162 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
|
1163 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
|
1164 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
|
1165 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
|
1166 set mouse& startofline |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1167 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1168 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1169 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
1170 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
|
1171 10new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1172 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
|
1173 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1174 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
|
1175 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
|
1176 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
|
1177 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
|
1178 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
|
1179 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
|
1180 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
|
1181 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
|
1182 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
|
1183 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
|
1184 call feedkeys("A\<PageUp>\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1185 call assert_equal([0, 29, 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("A\<PageUp>\<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, 21, 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("A\<PageUp>\<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, 13, 1, 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\<PageUp>\<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, 5, 1, 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\<PageUp>\<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, 5, 11, 0], getpos('.')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1194 " <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
|
1195 " <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
|
1196 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1197 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
|
1198 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
|
1199 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
|
1200 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
|
1201 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
|
1202 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
|
1203 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
|
1204 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
|
1205 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
|
1206 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
|
1207 call feedkeys("A\<S-Up>\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1208 call assert_equal([0, 29, 1, 0], getpos('.')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1209 call feedkeys("A\<S-Up>\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1210 call assert_equal([0, 21, 1, 0], getpos('.')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1211 call feedkeys("A\<S-Up>\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1212 call assert_equal([0, 13, 1, 0], getpos('.')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1213 call feedkeys("A\<S-Up>\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1214 call assert_equal([0, 5, 1, 0], getpos('.')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1215 call feedkeys("A\<S-Up>\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1216 call assert_equal([0, 5, 11, 0], getpos('.')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1217 set nostartofline |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1218 call cursor(30, 11) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1219 norm! zt |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1220 call feedkeys("A\<PageUp>\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1221 call assert_equal([0, 29, 11, 0], getpos('.')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1222 call feedkeys("A\<PageUp>\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1223 call assert_equal([0, 21, 11, 0], getpos('.')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1224 call feedkeys("A\<PageUp>\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1225 call assert_equal([0, 13, 11, 0], getpos('.')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1226 call feedkeys("A\<PageUp>\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1227 call assert_equal([0, 5, 11, 0], getpos('.')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1228 call feedkeys("A\<PageUp>\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1229 call assert_equal([0, 5, 11, 0], getpos('.')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1230 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1231 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
|
1232 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
|
1233 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
|
1234 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
|
1235 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
|
1236 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
|
1237 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
|
1238 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
|
1239 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
|
1240 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
|
1241 " <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
|
1242 " <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
|
1243 call cursor(30, 11) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1244 norm! zt |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1245 call feedkeys("A\<S-Up>\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1246 call assert_equal([0, 29, 11, 0], getpos('.')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1247 call feedkeys("A\<S-Up>\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1248 call assert_equal([0, 21, 11, 0], getpos('.')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1249 call feedkeys("A\<S-Up>\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1250 call assert_equal([0, 13, 11, 0], getpos('.')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1251 call feedkeys("A\<S-Up>\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1252 call assert_equal([0, 5, 11, 0], getpos('.')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1253 call feedkeys("A\<S-Up>\<esc>", 'tnix') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1254 call assert_equal([0, 5, 11, 0], getpos('.')) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1255 call cursor(1, 1) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1256 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
|
1257 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
|
1258 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
|
1259 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
|
1260 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
|
1261 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
|
1262 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
|
1263 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
|
1264 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
|
1265 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
|
1266 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1267 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1268 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
1269 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
|
1270 new |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1271 " 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
|
1272 call setline(1, 'a') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1273 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
|
1274 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
|
1275 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
|
1276 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
|
1277 delcom Sandbox |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1278 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
|
1279 " 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
|
1280 fu! DoIt() |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1281 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
|
1282 endfu |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1283 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
|
1284 try |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1285 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
|
1286 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
|
1287 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
|
1288 endtry |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1289 " 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
|
1290 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
|
1291 delfu DoIt |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1292 try |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1293 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
|
1294 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
|
1295 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
|
1296 endtry |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1297 au! InsertCharPre |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1298 " 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
|
1299 fun! Complete(findstart, base) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1300 if a:findstart |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1301 return col('.') |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1302 else |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1303 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
|
1304 return [] |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1305 endif |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1306 endfun |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1307 set completefunc=Complete |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1308 try |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1309 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
|
1310 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
|
1311 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
|
1312 endtry |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1313 delfu Complete |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1314 set completefunc= |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1315 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
|
1316 " 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
|
1317 set revins fkmap |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1318 try |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1319 normal Ri |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1320 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
|
1321 catch |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1322 finally |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1323 set norevins nofkmap |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1324 endtry |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1325 endif |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1326 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1327 endfunc |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1328 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14985
diff
changeset
|
1329 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
|
1330 " 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
|
1331 CheckFeature rightleft |
11105
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1332 call NewWindow(10, 20) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1333 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
|
1334 call cursor(1, 2) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1335 set rightleft |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1336 " Screen looks as expected |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1337 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
|
1338 let expect = [ |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1339 \" cba", |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1340 \" fed", |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1341 \" ihg", |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1342 \" ~"] |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1343 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
|
1344 " 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
|
1345 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
|
1346 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
|
1347 call cursor(1, 2) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1348 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
|
1349 call cursor(1, 2) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1350 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
|
1351 " Screen looks as expected |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1352 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
|
1353 let expect = [ |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1354 \" cb", |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1355 \" fed", |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1356 \" ihg", |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1357 \" ~"] |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1358 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
|
1359 " 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
|
1360 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
|
1361 call cursor(1, 2) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1362 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
|
1363 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
|
1364 call cursor(1, 2) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1365 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
|
1366 call cursor(1, 2) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1367 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
|
1368 " Screen looks as expected |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1369 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
|
1370 let expect = [ |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1371 \" ca", |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1372 \" fed", |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1373 \" ihg", |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1374 \" ~"] |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1375 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
|
1376 %d _ |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1377 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
|
1378 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
|
1379 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
|
1380 redraw! |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1381 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
|
1382 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
|
1383 set norightleft |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1384 bw! |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1385 endfunc |
11289
e0309111d976
patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents:
11171
diff
changeset
|
1386 |
e0309111d976
patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents:
11171
diff
changeset
|
1387 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
|
1388 " 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
|
1389 CheckUnix |
11319
2dc624388934
patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents:
11315
diff
changeset
|
1390 |
2dc624388934
patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents:
11315
diff
changeset
|
1391 let dirname = getcwd() . "/Xdir" |
2dc624388934
patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents:
11315
diff
changeset
|
1392 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
|
1393 try |
2dc624388934
patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents:
11315
diff
changeset
|
1394 call mkdir(longdirname, 'p') |
2dc624388934
patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents:
11315
diff
changeset
|
1395 catch /E739:/ |
2dc624388934
patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents:
11315
diff
changeset
|
1396 " 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
|
1397 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
|
1398 return |
2dc624388934
patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents:
11315
diff
changeset
|
1399 endtry |
2dc624388934
patch 8.0.0545: edit test may fail on some systems
Christian Brabandt <cb@256bit.org>
parents:
11315
diff
changeset
|
1400 |
16692
2e689fb67c91
patch 8.1.1348: running tests may cause the window to move
Bram Moolenaar <Bram@vim.org>
parents:
16419
diff
changeset
|
1401 " 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
|
1402 " 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
|
1403 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
|
1404 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
|
1405 |
2e689fb67c91
patch 8.1.1348: running tests may cause the window to move
Bram Moolenaar <Bram@vim.org>
parents:
16419
diff
changeset
|
1406 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
|
1407 " 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
|
1408 " 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
|
1409 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
|
1410 sleep 100m |
2e689fb67c91
patch 8.1.1348: running tests may cause the window to move
Bram Moolenaar <Bram@vim.org>
parents:
16419
diff
changeset
|
1411 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
|
1412 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
|
1413 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
|
1414 endif |
2e689fb67c91
patch 8.1.1348: running tests may cause the window to move
Bram Moolenaar <Bram@vim.org>
parents:
16419
diff
changeset
|
1415 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
|
1416 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
|
1417 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
|
1418 endif |
2e689fb67c91
patch 8.1.1348: running tests may cause the window to move
Bram Moolenaar <Bram@vim.org>
parents:
16419
diff
changeset
|
1419 endif |
2e689fb67c91
patch 8.1.1348: running tests may cause the window to move
Bram Moolenaar <Bram@vim.org>
parents:
16419
diff
changeset
|
1420 |
11289
e0309111d976
patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents:
11171
diff
changeset
|
1421 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
|
1422 " 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
|
1423 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
|
1424 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
|
1425 |
11289
e0309111d976
patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents:
11171
diff
changeset
|
1426 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
|
1427 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
|
1428 new |
e0309111d976
patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents:
11171
diff
changeset
|
1429 exe "next Xfile " . longfilename |
e0309111d976
patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents:
11171
diff
changeset
|
1430 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
|
1431 |
e0309111d976
patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents:
11171
diff
changeset
|
1432 bwipe! |
e0309111d976
patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents:
11171
diff
changeset
|
1433 exe 'bwipe! ' . longfilename |
e0309111d976
patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents:
11171
diff
changeset
|
1434 call delete(dirname, 'rf') |
e0309111d976
patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents:
11171
diff
changeset
|
1435 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
|
1436 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
|
1437 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
|
1438 endif |
11289
e0309111d976
patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents:
11171
diff
changeset
|
1439 set swapfile& |
e0309111d976
patch 8.0.0530: buffer overflow when 'columns' is very big
Christian Brabandt <cb@256bit.org>
parents:
11171
diff
changeset
|
1440 endfunc |
12654
d03798bddf5e
patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
1441 |
14409
9ffce640d0d3
patch 8.1.0219: expanding ## fails to escape backtick
Christian Brabandt <cb@256bit.org>
parents:
14039
diff
changeset
|
1442 func Test_edit_backtick() |
9ffce640d0d3
patch 8.1.0219: expanding ## fails to escape backtick
Christian Brabandt <cb@256bit.org>
parents:
14039
diff
changeset
|
1443 next a\`b c |
9ffce640d0d3
patch 8.1.0219: expanding ## fails to escape backtick
Christian Brabandt <cb@256bit.org>
parents:
14039
diff
changeset
|
1444 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
|
1445 next |
9ffce640d0d3
patch 8.1.0219: expanding ## fails to escape backtick
Christian Brabandt <cb@256bit.org>
parents:
14039
diff
changeset
|
1446 call assert_equal('c', expand('%')) |
9ffce640d0d3
patch 8.1.0219: expanding ## fails to escape backtick
Christian Brabandt <cb@256bit.org>
parents:
14039
diff
changeset
|
1447 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
|
1448 endfunc |
9ffce640d0d3
patch 8.1.0219: expanding ## fails to escape backtick
Christian Brabandt <cb@256bit.org>
parents:
14039
diff
changeset
|
1449 |
12654
d03798bddf5e
patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
1450 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
|
1451 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
|
1452 split |
d03798bddf5e
patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
1453 new |
d03798bddf5e
patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
1454 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
|
1455 3wincmd w |
d03798bddf5e
patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
1456 redraw! |
d03798bddf5e
patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
1457 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
|
1458 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
|
1459 only |
d03798bddf5e
patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
1460 endfunc |
d03798bddf5e
patch 8.0.1205: it is possible to unload a changed buffer
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
1461 |
14033
bcda3b864c31
patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
1462 func Test_edit_alt() |
bcda3b864c31
patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
1463 " 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
|
1464 new |
bcda3b864c31
patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
1465 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
|
1466 w XAltFile |
bcda3b864c31
patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
1467 $ |
bcda3b864c31
patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
1468 call assert_equal(3, line('.')) |
bcda3b864c31
patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
1469 e Xother |
bcda3b864c31
patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
1470 e # |
bcda3b864c31
patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
1471 call assert_equal(3, line('.')) |
bcda3b864c31
patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
1472 |
bcda3b864c31
patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
1473 bwipe XAltFile |
bcda3b864c31
patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
1474 call delete('XAltFile') |
bcda3b864c31
patch 8.1.0034: cursor not restored with ":edit #"
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
1475 endfunc |
14985
4ebda55537a5
patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents:
14409
diff
changeset
|
1476 |
20187
79cc97206476
patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
1477 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
|
1478 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
|
1479 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
|
1480 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
|
1481 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
|
1482 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
|
1483 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
|
1484 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
|
1485 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
|
1486 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
|
1487 |
22651
fba5ccf33794
patch 8.2.1874: can't do something just before leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
22588
diff
changeset
|
1488 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
|
1489 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
|
1490 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
|
1491 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
|
1492 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
|
1493 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
|
1494 |
4ebda55537a5
patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents:
14409
diff
changeset
|
1495 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
|
1496 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
|
1497 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
|
1498 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
|
1499 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
|
1500 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
|
1501 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
|
1502 |
4ebda55537a5
patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents:
14409
diff
changeset
|
1503 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
|
1504 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
|
1505 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
|
1506 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
|
1507 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
|
1508 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
|
1509 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
|
1510 |
4ebda55537a5
patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents:
14409
diff
changeset
|
1511 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
|
1512 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
|
1513 iunmap x |
4ebda55537a5
patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Bram Moolenaar <Bram@vim.org>
parents:
14409
diff
changeset
|
1514 endfunc |
16419
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
16011
diff
changeset
|
1515 |
20187
79cc97206476
patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
1516 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
|
1517 new XtestUndo |
79cc97206476
patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
1518 set undofile |
79cc97206476
patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
1519 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
|
1520 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
|
1521 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
|
1522 normal u |
79cc97206476
patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
1523 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
|
1524 |
79cc97206476
patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
1525 bwipe! |
79cc97206476
patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
1526 au! InsertLeave |
79cc97206476
patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
1527 call delete('XtestUndo') |
20861
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1528 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
|
1529 set undofile& |
79cc97206476
patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
1530 endfunc |
79cc97206476
patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
1531 |
16419
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
16011
diff
changeset
|
1532 " 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
|
1533 func Test_edit_special_chars() |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
16011
diff
changeset
|
1534 new |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
16011
diff
changeset
|
1535 |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
16011
diff
changeset
|
1536 if has("ebcdic") |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
16011
diff
changeset
|
1537 let t = "o\<C-V>193\<C-V>xc2\<C-V>o303 \<C-V>90a\<C-V>xfg\<C-V>o578\<Esc>" |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
16011
diff
changeset
|
1538 else |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
16011
diff
changeset
|
1539 let t = "o\<C-V>65\<C-V>x42\<C-V>o103 \<C-V>33a\<C-V>xfg\<C-V>o78\<Esc>" |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
16011
diff
changeset
|
1540 endif |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
16011
diff
changeset
|
1541 |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
16011
diff
changeset
|
1542 exe "normal " . t |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
16011
diff
changeset
|
1543 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
|
1544 |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
16011
diff
changeset
|
1545 close! |
aebcd20a8a3f
patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents:
16011
diff
changeset
|
1546 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
|
1547 |
2ea47dee7ddd
patch 8.1.1988: :startinsert! does not work the same way as "A"
Bram Moolenaar <Bram@vim.org>
parents:
17857
diff
changeset
|
1548 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
|
1549 new |
2ea47dee7ddd
patch 8.1.1988: :startinsert! does not work the same way as "A"
Bram Moolenaar <Bram@vim.org>
parents:
17857
diff
changeset
|
1550 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
|
1551 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
|
1552 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
|
1553 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
|
1554 |
2ea47dee7ddd
patch 8.1.1988: :startinsert! does not work the same way as "A"
Bram Moolenaar <Bram@vim.org>
parents:
17857
diff
changeset
|
1555 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
|
1556 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
|
1557 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
|
1558 |
2ea47dee7ddd
patch 8.1.1988: :startinsert! does not work the same way as "A"
Bram Moolenaar <Bram@vim.org>
parents:
17857
diff
changeset
|
1559 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
|
1560 bwipe! |
2ea47dee7ddd
patch 8.1.1988: :startinsert! does not work the same way as "A"
Bram Moolenaar <Bram@vim.org>
parents:
17857
diff
changeset
|
1561 endfunc |
18534
7dd83b5325e9
patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
17984
diff
changeset
|
1562 |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19195
diff
changeset
|
1563 " 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
|
1564 func Test_edit_startreplace() |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19195
diff
changeset
|
1565 new |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19195
diff
changeset
|
1566 call setline(1, 'abc') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19195
diff
changeset
|
1567 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
|
1568 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
|
1569 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
|
1570 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
|
1571 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
|
1572 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
|
1573 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
|
1574 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
|
1575 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
|
1576 close! |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19195
diff
changeset
|
1577 endfunc |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19195
diff
changeset
|
1578 |
18534
7dd83b5325e9
patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
17984
diff
changeset
|
1579 func Test_edit_noesckeys() |
18538
c4d97a18af37
patch 8.1.2263: 'noesckeys' test fails in GUI
Bram Moolenaar <Bram@vim.org>
parents:
18534
diff
changeset
|
1580 CheckNotGui |
18534
7dd83b5325e9
patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
17984
diff
changeset
|
1581 new |
7dd83b5325e9
patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
17984
diff
changeset
|
1582 |
7dd83b5325e9
patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
17984
diff
changeset
|
1583 " <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
|
1584 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
|
1585 set esckeys |
7dd83b5325e9
patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
17984
diff
changeset
|
1586 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
|
1587 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
|
1588 |
7dd83b5325e9
patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
17984
diff
changeset
|
1589 " <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
|
1590 set noesckeys |
7dd83b5325e9
patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
17984
diff
changeset
|
1591 call setline(1, '') |
7dd83b5325e9
patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
17984
diff
changeset
|
1592 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
|
1593 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
|
1594 |
7dd83b5325e9
patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
17984
diff
changeset
|
1595 bwipe! |
7dd83b5325e9
patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
17984
diff
changeset
|
1596 set esckeys |
7dd83b5325e9
patch 8.1.2261: with modifyOtherKeys set 'noesckeys' doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
17984
diff
changeset
|
1597 endfunc |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19195
diff
changeset
|
1598 |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
1599 " 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
|
1600 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
|
1601 new |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
1602 set showmode showcmd |
20861
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1603 " 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
|
1604 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
|
1605 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
|
1606 try |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
1607 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
|
1608 catch /E492:/ |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
1609 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
|
1610 endtry |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
1611 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
|
1612 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
|
1613 set showmode& showcmd& |
20861
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1614 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
|
1615 close! |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1616 endfunc |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1617 |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1618 " 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
|
1619 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
|
1620 CheckEnglish |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1621 new |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1622 redir => msg |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1623 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
|
1624 redir END |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1625 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
|
1626 close! |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1627 endfunc |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1628 |
22490
23a5977d7211
patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
1629 " 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
|
1630 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
|
1631 CheckEnglish |
23a5977d7211
patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
1632 let dirname = getcwd() . "/Xdir" |
23a5977d7211
patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
1633 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
|
1634 |
23a5977d7211
patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
1635 new |
23a5977d7211
patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
1636 redir => msg |
23a5977d7211
patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
1637 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
|
1638 redir END |
23a5977d7211
patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
1639 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
|
1640 bwipe! |
23a5977d7211
patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
1641 |
23a5977d7211
patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
1642 let dirname .= '/' |
23a5977d7211
patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
1643 |
23a5977d7211
patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
1644 new |
23a5977d7211
patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
1645 redir => msg |
23a5977d7211
patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
1646 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
|
1647 redir END |
23a5977d7211
patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
1648 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
|
1649 bwipe! |
23a5977d7211
patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
1650 |
23a5977d7211
patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
1651 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
|
1652 endfunc |
23a5977d7211
patch 8.2.1793: not consistently giving the "is a directory" warning
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
1653 |
20861
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1654 " 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
|
1655 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
|
1656 CheckEnglish |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1657 call writefile([], 'Xfile') |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1658 redir => msg |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1659 new ++enc=axbyc Xfile |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1660 redir END |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1661 call assert_match('\[NOT converted\]', msg) |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1662 call delete('Xfile') |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
1663 close! |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
1664 endfunc |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19613
diff
changeset
|
1665 |
20861
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1666 " 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
|
1667 func Test_edit_charconvert() |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1668 CheckEnglish |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1669 call writefile(['one', 'two'], 'Xfile') |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1670 |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1671 " 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
|
1672 set charconvert=NonExitingFunc() |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1673 new |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1674 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
|
1675 try |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1676 redir => msg |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1677 edit ++enc=axbyc Xfile |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1678 catch /E117:/ |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1679 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
|
1680 finally |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1681 redir END |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1682 endtry |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1683 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
|
1684 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
|
1685 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
|
1686 close! |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1687 set charconvert& |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1688 |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1689 " 'charconvert' function doesn't create a output file |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1690 func Cconv1() |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1691 endfunc |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1692 set charconvert=Cconv1() |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1693 new |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1694 redir => msg |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1695 edit ++enc=axbyc Xfile |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1696 redir END |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1697 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
|
1698 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
|
1699 close! |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1700 delfunc Cconv1 |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1701 set charconvert& |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1702 |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1703 " '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
|
1704 func Cconv2() |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1705 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
|
1706 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
|
1707 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
|
1708 endfunc |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1709 set charconvert=Cconv2() |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1710 new Xfile |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1711 write ++enc=ucase Xfile1 |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1712 call assert_equal(['ONE', 'TWO'], readfile('Xfile1')) |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1713 call delete('Xfile1') |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1714 close! |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1715 delfunc Cconv2 |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1716 set charconvert& |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1717 |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1718 " '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
|
1719 func Cconv3() |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1720 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
|
1721 endfunc |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1722 set charconvert=Cconv3() |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1723 new |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1724 call assert_fails('edit ++enc=lcase Xfile', 'E202:') |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1725 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
|
1726 close! |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1727 delfunc Cconv3 |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1728 set charconvert& |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1729 |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1730 call delete('Xfile') |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1731 endfunc |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1732 |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1733 " 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
|
1734 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
|
1735 CheckUnix |
24164
2259c73cc1d9
patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents:
24057
diff
changeset
|
1736 CheckNotRoot |
2259c73cc1d9
patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents:
24057
diff
changeset
|
1737 |
20861
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1738 call writefile(['one', 'two'], 'Xfile') |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1739 call setfperm('Xfile', '-w-------') |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1740 new |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1741 redir => msg |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1742 edit Xfile |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1743 redir END |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1744 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
|
1745 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
|
1746 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
|
1747 close! |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1748 call delete('Xfile') |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1749 endfunc |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20832
diff
changeset
|
1750 |
20941
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1751 " Pressing escape in 'insertmode' should beep |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1752 func Test_edit_insertmode_esc_beeps() |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1753 new |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1754 set insertmode |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1755 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
|
1756 set insertmode& |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1757 " unsupported CTRL-G command should beep 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
|
1758 call assert_beeps("normal i\<C-G>l") |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1759 close! |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1760 endfunc |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1761 |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1762 " 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
|
1763 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
|
1764 CheckFeature rightleft |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1765 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
|
1766 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
|
1767 endif |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1768 new |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1769 |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1770 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
|
1771 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
|
1772 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
|
1773 let str ..= '`/'',.;' |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1774 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
|
1775 let expected = "óõú,.;" |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1776 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
|
1777 let expected ..= "æèñ'äåà ãø/ôÃîöêìçïéòë÷âáðù" |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1778 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
|
1779 |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1780 %d |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1781 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
|
1782 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
|
1783 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
|
1784 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
|
1785 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
|
1786 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
|
1787 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
|
1788 |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1789 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
|
1790 close! |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1791 endfunc |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1792 |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1793 " 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
|
1794 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
|
1795 CheckFeature rightleft |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1796 new |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1797 set allowrevins |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1798 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
|
1799 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
|
1800 set allowrevins& |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1801 close! |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1802 endfunc |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1803 |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1804 " 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
|
1805 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
|
1806 new |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1807 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
|
1808 func SaveFirstLine() |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1809 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
|
1810 return 'r' |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1811 endfunc |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1812 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
|
1813 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
|
1814 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
|
1815 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
|
1816 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
|
1817 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
|
1818 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
|
1819 close! |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1820 endfunc |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1821 |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1822 " 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
|
1823 " 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
|
1824 " 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
|
1825 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
|
1826 new |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1827 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
|
1828 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
|
1829 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
|
1830 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
|
1831 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
|
1832 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
|
1833 redraw! |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1834 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
|
1835 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
|
1836 |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1837 " 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
|
1838 1,2fold |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1839 normal gg |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1840 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
|
1841 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
|
1842 redraw! |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1843 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
|
1844 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
|
1845 |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1846 close! |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1847 endfunc |
505d97ea54da
patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
1848 |
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
|
1849 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
|
1850 " 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
|
1851 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
|
1852 |
050cff1294ab
patch 8.2.1842: crash when USE_FNAME_CASE is defined and using :browse
Bram Moolenaar <Bram@vim.org>
parents:
22490
diff
changeset
|
1853 " ":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
|
1854 " 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
|
1855 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
|
1856 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
|
1857 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
|
1858 |
050cff1294ab
patch 8.2.1842: crash when USE_FNAME_CASE is defined and using :browse
Bram Moolenaar <Bram@vim.org>
parents:
22490
diff
changeset
|
1859 " 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
|
1860 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
|
1861 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
|
1862 |
050cff1294ab
patch 8.2.1842: crash when USE_FNAME_CASE is defined and using :browse
Bram Moolenaar <Bram@vim.org>
parents:
22490
diff
changeset
|
1863 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
|
1864 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
|
1865 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
|
1866 |
22724
51bc501a13ca
patch 8.2.1910: reading past the end of the command line
Bram Moolenaar <Bram@vim.org>
parents:
22651
diff
changeset
|
1867 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
|
1868 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
|
1869 " 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
|
1870 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
|
1871 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
|
1872 endfunc |
51bc501a13ca
patch 8.2.1910: reading past the end of the command line
Bram Moolenaar <Bram@vim.org>
parents:
22651
diff
changeset
|
1873 |
24882
4c1b6f3eb96b
patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24204
diff
changeset
|
1874 " 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
|
1875 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
|
1876 CheckFeature rightleft |
4c1b6f3eb96b
patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24204
diff
changeset
|
1877 new |
4c1b6f3eb96b
patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24204
diff
changeset
|
1878 set revins |
4c1b6f3eb96b
patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24204
diff
changeset
|
1879 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
|
1880 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
|
1881 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
|
1882 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
|
1883 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
|
1884 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
|
1885 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
|
1886 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
|
1887 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
|
1888 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
|
1889 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
|
1890 " 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
|
1891 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
|
1892 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
|
1893 call assert_equal(['one two three', 'ruof'], getline(1, '$')) |
4c1b6f3eb96b
patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24204
diff
changeset
|
1894 set revins& |
4c1b6f3eb96b
patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24204
diff
changeset
|
1895 bw! |
4c1b6f3eb96b
patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24204
diff
changeset
|
1896 endfunc |
4c1b6f3eb96b
patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24204
diff
changeset
|
1897 |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19195
diff
changeset
|
1898 " vim: shiftwidth=2 sts=2 expandtab |