Mercurial > vim
annotate src/testdir/test_popup.vim @ 10100:26441931dad7 v7.4.2321
commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 3 22:35:40 2016 +0200
patch 7.4.2321
Problem: When a test is commented out we forget about it.
Solution: Let a test throw an exception with "Skipped" and list skipped test
functions. (Christian Brabandt)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 03 Sep 2016 22:45:06 +0200 |
parents | f17ba1c9d209 |
children | fb040c9d8ce9 |
rev | line source |
---|---|
9359
35b173e37dc6
commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Test for completion menu |
35b173e37dc6
commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
35b173e37dc6
commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 let g:months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] |
35b173e37dc6
commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 let g:setting = '' |
35b173e37dc6
commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 |
9742
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
6 func! ListMonths() |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
7 if g:setting != '' |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
8 exe ":set" g:setting |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
9 endif |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
10 let mth=copy(g:months) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
11 let entered = strcharpart(getline('.'),0,col('.')) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
12 if !empty(entered) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
13 let mth=filter(mth, 'v:val=~"^".entered') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
14 endif |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
15 call complete(1, mth) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
16 return '' |
9359
35b173e37dc6
commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 endfunc |
35b173e37dc6
commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 |
10100
26441931dad7
commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents:
9826
diff
changeset
|
19 func! Test_popup_complete2() |
26441931dad7
commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents:
9826
diff
changeset
|
20 " Insert match immediately, if there is only one match |
26441931dad7
commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents:
9826
diff
changeset
|
21 " <c-e> Should select a character from the line below |
26441931dad7
commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents:
9826
diff
changeset
|
22 " TODO: test disabled because the code change has been reverted. |
26441931dad7
commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents:
9826
diff
changeset
|
23 throw "Skipped: Bug with <c-e> and popupmenu not fixed yet" |
26441931dad7
commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents:
9826
diff
changeset
|
24 new |
26441931dad7
commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents:
9826
diff
changeset
|
25 inoremap <f5> <c-r>=ListMonths()<cr> |
26441931dad7
commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents:
9826
diff
changeset
|
26 call append(1, ["December2015"]) |
26441931dad7
commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents:
9826
diff
changeset
|
27 :1 |
26441931dad7
commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents:
9826
diff
changeset
|
28 call feedkeys("aD\<f5>\<C-E>\<C-E>\<C-E>\<C-E>\<enter>\<esc>", 'tx') |
26441931dad7
commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents:
9826
diff
changeset
|
29 call assert_equal(["December2015", "", "December2015"], getline(1,3)) |
26441931dad7
commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents:
9826
diff
changeset
|
30 %d |
26441931dad7
commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents:
9826
diff
changeset
|
31 bw! |
26441931dad7
commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents:
9826
diff
changeset
|
32 endfu |
26441931dad7
commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents:
9826
diff
changeset
|
33 |
9742
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
34 func! Test_popup_complete() |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
35 new |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
36 inoremap <f5> <c-r>=ListMonths()<cr> |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
37 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
38 " <C-E> - select original typed text before the completion started |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
39 call feedkeys("aJu\<f5>\<down>\<c-e>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
40 call assert_equal(["Ju"], getline(1,2)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
41 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
42 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
43 " <C-Y> - accept current match |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
44 call feedkeys("a\<f5>". repeat("\<down>",7). "\<c-y>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
45 call assert_equal(["August"], getline(1,2)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
46 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
47 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
48 " <BS> - Delete one character from the inserted text (state: 1) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
49 " TODO: This should not end the completion, but it does. |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
50 " This should according to the documentation: |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
51 " January |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
52 " but instead, this does |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
53 " Januar |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
54 " (idea is, C-L inserts the match from the popup menu |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
55 " but if the menu is closed, it will insert the character <c-l> |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
56 call feedkeys("aJ\<f5>\<bs>\<c-l>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
57 call assert_equal(["Januar"], getline(1,2)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
58 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
59 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
60 " any-non special character: Stop completion without changing the match |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
61 " and insert the typed character |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
62 call feedkeys("a\<f5>20", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
63 call assert_equal(["January20"], getline(1,2)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
64 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
65 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
66 " any-non printable, non-white character: Add this character and |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
67 " reduce number of matches |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
68 call feedkeys("aJu\<f5>\<c-p>l\<c-y>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
69 call assert_equal(["Jul"], getline(1,2)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
70 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
71 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
72 " any-non printable, non-white character: Add this character and |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
73 " reduce number of matches |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
74 call feedkeys("aJu\<f5>\<c-p>l\<c-n>\<c-y>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
75 call assert_equal(["July"], getline(1,2)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
76 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
77 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
78 " any-non printable, non-white character: Add this character and |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
79 " reduce number of matches |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
80 call feedkeys("aJu\<f5>\<c-p>l\<c-e>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
81 call assert_equal(["Jul"], getline(1,2)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
82 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
83 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
84 " <BS> - Delete one character from the inserted text (state: 2) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
85 call feedkeys("a\<f5>\<c-n>\<bs>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
86 call assert_equal(["Februar"], getline(1,2)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
87 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
88 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
89 " <c-l> - Insert one character from the current match |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
90 call feedkeys("aJ\<f5>".repeat("\<c-n>",3)."\<c-l>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
91 call assert_equal(["J"], getline(1,2)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
92 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
93 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
94 " <c-l> - Insert one character from the current match |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
95 call feedkeys("aJ\<f5>".repeat("\<c-n>",4)."\<c-l>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
96 call assert_equal(["January"], getline(1,2)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
97 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
98 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
99 " <c-y> - Accept current selected match |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
100 call feedkeys("aJ\<f5>\<c-y>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
101 call assert_equal(["January"], getline(1,2)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
102 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
103 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
104 " <c-e> - End completion, go back to what was there before selecting a match |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
105 call feedkeys("aJu\<f5>\<c-e>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
106 call assert_equal(["Ju"], getline(1,2)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
107 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
108 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
109 " <PageUp> - Select a match several entries back |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
110 call feedkeys("a\<f5>\<PageUp>\<c-y>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
111 call assert_equal([""], getline(1,2)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
112 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
113 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
114 " <PageUp><PageUp> - Select a match several entries back |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
115 call feedkeys("a\<f5>\<PageUp>\<PageUp>\<c-y>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
116 call assert_equal(["December"], getline(1,2)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
117 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
118 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
119 " <PageUp><PageUp><PageUp> - Select a match several entries back |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
120 call feedkeys("a\<f5>\<PageUp>\<PageUp>\<PageUp>\<c-y>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
121 call assert_equal(["February"], getline(1,2)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
122 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
123 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
124 " <PageDown> - Select a match several entries further |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
125 call feedkeys("a\<f5>\<PageDown>\<c-y>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
126 call assert_equal(["November"], getline(1,2)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
127 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
128 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
129 " <PageDown><PageDown> - Select a match several entries further |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
130 call feedkeys("a\<f5>\<PageDown>\<PageDown>\<c-y>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
131 call assert_equal(["December"], getline(1,2)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
132 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
133 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
134 " <PageDown><PageDown><PageDown> - Select a match several entries further |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
135 call feedkeys("a\<f5>\<PageDown>\<PageDown>\<PageDown>\<c-y>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
136 call assert_equal([""], getline(1,2)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
137 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
138 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
139 " <PageDown><PageDown><PageDown><PageDown> - Select a match several entries further |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
140 call feedkeys("a\<f5>".repeat("\<PageDown>",4)."\<c-y>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
141 call assert_equal(["October"], getline(1,2)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
142 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
143 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
144 " <Up> - Select a match don't insert yet |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
145 call feedkeys("a\<f5>\<Up>\<c-y>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
146 call assert_equal([""], getline(1,2)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
147 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
148 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
149 " <Up><Up> - Select a match don't insert yet |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
150 call feedkeys("a\<f5>\<Up>\<Up>\<c-y>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
151 call assert_equal(["December"], getline(1,2)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
152 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
153 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
154 " <Up><Up><Up> - Select a match don't insert yet |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
155 call feedkeys("a\<f5>\<Up>\<Up>\<Up>\<c-y>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
156 call assert_equal(["November"], getline(1,2)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
157 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
158 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
159 " <Tab> - Stop completion and insert the match |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
160 call feedkeys("a\<f5>\<Tab>\<c-y>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
161 call assert_equal(["January "], getline(1,2)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
162 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
163 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
164 " <Space> - Stop completion and insert the match |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
165 call feedkeys("a\<f5>".repeat("\<c-p>",5)." \<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
166 call assert_equal(["September "], getline(1,2)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
167 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
168 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
169 " <Enter> - Use the text and insert line break (state: 1) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
170 call feedkeys("a\<f5>\<enter>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
171 call assert_equal(["January", ''], getline(1,2)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
172 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
173 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
174 " <Enter> - Insert the current selected text (state: 2) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
175 call feedkeys("a\<f5>".repeat("\<Up>",5)."\<enter>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
176 call assert_equal(["September"], getline(1,2)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
177 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
178 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
179 " Insert match immediately, if there is only one match |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
180 " <c-y> selects a character from the line above |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
181 call append(0, ["December2015"]) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
182 call feedkeys("aD\<f5>\<C-Y>\<C-Y>\<C-Y>\<C-Y>\<enter>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
183 call assert_equal(["December2015", "December2015", ""], getline(1,3)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
184 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
185 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
186 " use menuone for 'completeopt' |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
187 " Since for the first <c-y> the menu is still shown, will only select |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
188 " three letters from the line above |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
189 set completeopt&vim |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
190 set completeopt+=menuone |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
191 call append(0, ["December2015"]) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
192 call feedkeys("aD\<f5>\<C-Y>\<C-Y>\<C-Y>\<C-Y>\<enter>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
193 call assert_equal(["December2015", "December201", ""], getline(1,3)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
194 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
195 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
196 " use longest for 'completeopt' |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
197 set completeopt&vim |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
198 call feedkeys("aM\<f5>\<C-N>\<C-P>\<c-e>\<enter>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
199 set completeopt+=longest |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
200 call feedkeys("aM\<f5>\<C-N>\<C-P>\<c-e>\<enter>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
201 call assert_equal(["M", "Ma", ""], getline(1,3)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
202 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
203 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
204 " use noselect/noinsert for 'completeopt' |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
205 set completeopt&vim |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
206 call feedkeys("aM\<f5>\<enter>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
207 set completeopt+=noselect |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
208 call feedkeys("aM\<f5>\<enter>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
209 set completeopt-=noselect completeopt+=noinsert |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
210 call feedkeys("aM\<f5>\<enter>\<esc>", 'tx') |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
211 call assert_equal(["March", "M", "March"], getline(1,4)) |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
212 %d |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
213 endfu |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
214 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
215 |
9359
35b173e37dc6
commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
216 func! Test_popup_completion_insertmode() |
9465
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
217 new |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
218 inoremap <F5> <C-R>=ListMonths()<CR> |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
219 |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
220 call feedkeys("a\<f5>\<down>\<enter>\<esc>", 'tx') |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
221 call assert_equal('February', getline(1)) |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
222 %d |
9742
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
223 " Set noinsertmode |
9465
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
224 let g:setting = 'noinsertmode' |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
225 call feedkeys("a\<f5>\<down>\<enter>\<esc>", 'tx') |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
226 call assert_equal('February', getline(1)) |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
227 call assert_false(pumvisible()) |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
228 %d |
9742
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
229 " Go through all matches, until none is selected |
9465
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
230 let g:setting = '' |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
231 call feedkeys("a\<f5>". repeat("\<c-n>",12)."\<enter>\<esc>", 'tx') |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
232 call assert_equal('', getline(1)) |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
233 %d |
9742
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
234 " select previous entry |
9465
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
235 call feedkeys("a\<f5>\<c-p>\<enter>\<esc>", 'tx') |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
236 call assert_equal('', getline(1)) |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
237 %d |
9742
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
238 " select last entry |
9465
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
239 call feedkeys("a\<f5>\<c-p>\<c-p>\<enter>\<esc>", 'tx') |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
240 call assert_equal('December', getline(1)) |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
241 |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
242 iunmap <F5> |
9359
35b173e37dc6
commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
243 endfunc |
9465
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
244 |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
245 function! ComplTest() abort |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
246 call complete(1, ['source', 'soundfold']) |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
247 return '' |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
248 endfunction |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
249 |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
250 func Test_noinsert_complete() |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
251 new |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
252 set completeopt+=noinsert |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
253 inoremap <F5> <C-R>=ComplTest()<CR> |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
254 call feedkeys("i\<F5>soun\<CR>\<CR>\<ESC>.", 'tx') |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
255 call assert_equal('soundfold', getline(1)) |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
256 call assert_equal('soundfold', getline(2)) |
9467
5fb484647e12
commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents:
9465
diff
changeset
|
257 bwipe! |
9465
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
258 |
9467
5fb484647e12
commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents:
9465
diff
changeset
|
259 new |
5fb484647e12
commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents:
9465
diff
changeset
|
260 inoremap <F5> <C-R>=Test()<CR> |
5fb484647e12
commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents:
9465
diff
changeset
|
261 call feedkeys("i\<F5>\<CR>\<ESC>", 'tx') |
5fb484647e12
commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents:
9465
diff
changeset
|
262 call assert_equal('source', getline(1)) |
9465
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
263 bwipe! |
9467
5fb484647e12
commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents:
9465
diff
changeset
|
264 |
9465
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
265 set completeopt-=noinsert |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
266 iunmap <F5> |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
267 endfunc |
9467
5fb484647e12
commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents:
9465
diff
changeset
|
268 |
5fb484647e12
commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents:
9465
diff
changeset
|
269 |
5fb484647e12
commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents:
9465
diff
changeset
|
270 function! Test() abort |
5fb484647e12
commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents:
9465
diff
changeset
|
271 call complete(1, ['source', 'soundfold']) |
5fb484647e12
commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents:
9465
diff
changeset
|
272 return '' |
5fb484647e12
commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents:
9465
diff
changeset
|
273 endfunction |
9742
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
274 |
0b0b9864c811
commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents:
9467
diff
changeset
|
275 " vim: shiftwidth=2 sts=2 expandtab |