annotate src/testdir/test_popup.vim @ 9744:6f5387822253 v7.4.2147

commit https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Aug 2 22:51:42 2016 +0200 patch 7.4.2147 Problem: test_alot fails. Solution: Close window.
author Christian Brabandt <cb@256bit.org>
date Tue, 02 Aug 2016 23:00:06 +0200
parents 0b0b9864c811
children 5440f3442841
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
19 func! Test_popup_complete()
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
20 new
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
21 inoremap <f5> <c-r>=ListMonths()<cr>
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
22
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
23 " <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
24 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
25 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
26 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
27
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
28 " <C-Y> - accept current match
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
29 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
30 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
31 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
32
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
33 " <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
34 " 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
35 " This should according to the documentation:
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
36 " January
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
37 " but instead, this does
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
38 " Januar
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
39 " (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
40 " 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
41 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
42 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
43 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
44
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
45 " 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
46 " and insert the typed character
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
47 call feedkeys("a\<f5>20", 'tx')
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
48 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
49 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
50
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
51 " 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
52 " reduce number of matches
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
53 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
54 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
55 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
56
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
57 " 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
58 " reduce number of matches
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
59 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
60 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
61 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
62
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
63 " 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
64 " reduce number of matches
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
65 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
66 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
67 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
68
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
69 " <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
70 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
71 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
72 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
73
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
74 " <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
75 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
76 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
77 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
78
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
79 " <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
80 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
81 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
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 " <c-y> - Accept current selected match
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
85 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
86 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
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-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
90 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
91 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
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 " <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
95 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
96 call assert_equal([""], 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 " <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
100 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
101 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
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 " <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
105 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
106 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
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 " <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
110 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
111 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
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 " <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
115 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
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 " <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
120 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
121 call assert_equal([""], 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><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
125 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
126 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
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 " <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
130 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
131 call assert_equal([""], 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 " <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
135 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
136 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
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 " <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
140 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
141 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
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 " <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
145 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
146 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
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 " <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
150 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
151 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
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 " <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
155 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
156 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
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 " <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
160 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
161 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
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 " 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
165 " <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
166 call append(0, ["December2015"])
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
167 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
168 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
169 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
170
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
171 " 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
172 " <c-e> Should select a character from the line below
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
173 call append(1, ["December2015"])
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
174 :1
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
175 call feedkeys("aD\<f5>\<C-E>\<C-E>\<C-E>\<C-E>\<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(["December2015", "", "December2015"], getline(1,3))
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 " use menuone for 'completeopt'
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
180 " 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
181 " three letters from the line above
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
182 set completeopt&vim
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
183 set completeopt+=menuone
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
184 call append(0, ["December2015"])
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
185 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
186 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
187 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
188
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
189 " use longest for 'completeopt'
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
190 set completeopt&vim
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
191 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
192 set completeopt+=longest
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
193 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
194 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
195 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
196
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
197 " use noselect/noinsert for 'completeopt'
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
198 set completeopt&vim
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
199 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
200 set completeopt+=noselect
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
201 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
202 set completeopt-=noselect completeopt+=noinsert
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
203 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
204 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
205 %d
9744
6f5387822253 commit https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65
Christian Brabandt <cb@256bit.org>
parents: 9742
diff changeset
206 bwipe!
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
207 endfu
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
208
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
209
9359
35b173e37dc6 commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
210 func! Test_popup_completion_insertmode()
9465
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
211 new
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
212 inoremap <F5> <C-R>=ListMonths()<CR>
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
213
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
214 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
215 call assert_equal('February', getline(1))
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
216 %d
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
217 " Set noinsertmode
9465
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
218 let g:setting = 'noinsertmode'
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
219 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
220 call assert_equal('February', getline(1))
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
221 call assert_false(pumvisible())
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 " 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
224 let g:setting = ''
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
225 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
226 call assert_equal('', getline(1))
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
227 %d
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
228 " select previous entry
9465
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
229 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
230 call assert_equal('', getline(1))
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
231 %d
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
232 " select last entry
9465
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
233 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
234 call assert_equal('December', getline(1))
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
235
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
236 bwipe!
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
237 iunmap <F5>
9359
35b173e37dc6 commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
238 endfunc
9465
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
239
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
240 function! ComplTest() abort
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
241 call complete(1, ['source', 'soundfold'])
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
242 return ''
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
243 endfunction
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 func Test_noinsert_complete()
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
246 new
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
247 set completeopt+=noinsert
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
248 inoremap <F5> <C-R>=ComplTest()<CR>
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
249 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
250 call assert_equal('soundfold', getline(1))
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
251 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
252 bwipe!
9465
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
253
9467
5fb484647e12 commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents: 9465
diff changeset
254 new
5fb484647e12 commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents: 9465
diff changeset
255 inoremap <F5> <C-R>=Test()<CR>
5fb484647e12 commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents: 9465
diff changeset
256 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
257 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
258 bwipe!
9467
5fb484647e12 commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents: 9465
diff changeset
259
9465
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
260 set completeopt-=noinsert
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
261 iunmap <F5>
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
262 endfunc
9467
5fb484647e12 commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents: 9465
diff changeset
263
5fb484647e12 commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents: 9465
diff changeset
264
5fb484647e12 commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents: 9465
diff changeset
265 function! Test() abort
5fb484647e12 commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents: 9465
diff changeset
266 call complete(1, ['source', 'soundfold'])
5fb484647e12 commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents: 9465
diff changeset
267 return ''
5fb484647e12 commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents: 9465
diff changeset
268 endfunction
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
269
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
270 " vim: shiftwidth=2 sts=2 expandtab