annotate src/testdir/test_popup.vim @ 12602:9359ed49d375 v8.0.1179

patch 8.0.1179: Test_popup_and_window_resize() does not always pass commit https://github.com/vim/vim/commit/631820536e4084e01bf990f9314ec385b60b21d7 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Oct 7 20:03:23 2017 +0200 patch 8.0.1179: Test_popup_and_window_resize() does not always pass Problem: Test_popup_and_window_resize() does not always pass. Solution: Do not use $VIMPROG, pass the Vim executable in the vimcmd file. (Ozaki Kiichi, closes #2186)
author Christian Brabandt <cb@256bit.org>
date Sat, 07 Oct 2017 20:15:04 +0200
parents 0d29a806e6d1
children 1fad9675d8fd
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
12566
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
3 source shared.vim
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
4
9359
35b173e37dc6 commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 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
6 let g:setting = ''
35b173e37dc6 commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
8 func! ListMonths()
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
9 if g:setting != ''
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
10 exe ":set" g:setting
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
11 endif
10714
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
12 let mth = copy(g:months)
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
13 let entered = strcharpart(getline('.'),0,col('.'))
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
14 if !empty(entered)
10714
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
15 let mth = filter(mth, 'v:val=~"^".entered')
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
16 endif
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
17 call complete(1, mth)
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
18 return ''
9359
35b173e37dc6 commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 endfunc
35b173e37dc6 commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20
10100
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9826
diff changeset
21 func! Test_popup_complete2()
10216
c41e1736ad47 commit https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880
Christian Brabandt <cb@256bit.org>
parents: 10120
diff changeset
22 " Although the popupmenu is not visible, this does not mean completion mode
c41e1736ad47 commit https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880
Christian Brabandt <cb@256bit.org>
parents: 10120
diff changeset
23 " has ended. After pressing <f5> to complete the currently typed char, Vim
c41e1736ad47 commit https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880
Christian Brabandt <cb@256bit.org>
parents: 10120
diff changeset
24 " still stays in the first state of the completion (:h ins-completion-menu),
c41e1736ad47 commit https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880
Christian Brabandt <cb@256bit.org>
parents: 10120
diff changeset
25 " although the popupmenu wasn't shown <c-e> will remove the inserted
c41e1736ad47 commit https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880
Christian Brabandt <cb@256bit.org>
parents: 10120
diff changeset
26 " completed text (:h complete_CTRL-E), while the following <c-e> will behave
c41e1736ad47 commit https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880
Christian Brabandt <cb@256bit.org>
parents: 10120
diff changeset
27 " like expected (:h i_CTRL-E)
10100
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9826
diff changeset
28 new
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9826
diff changeset
29 inoremap <f5> <c-r>=ListMonths()<cr>
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9826
diff changeset
30 call append(1, ["December2015"])
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9826
diff changeset
31 :1
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9826
diff changeset
32 call feedkeys("aD\<f5>\<C-E>\<C-E>\<C-E>\<C-E>\<enter>\<esc>", 'tx')
10216
c41e1736ad47 commit https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880
Christian Brabandt <cb@256bit.org>
parents: 10120
diff changeset
33 call assert_equal(["Dece", "", "December2015"], getline(1,3))
10100
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9826
diff changeset
34 %d
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9826
diff changeset
35 bw!
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9826
diff changeset
36 endfu
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9826
diff changeset
37
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
38 func! Test_popup_complete()
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
39 new
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
40 inoremap <f5> <c-r>=ListMonths()<cr>
12566
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
41 set belloff=all
9742
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-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
44 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
45 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
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 " <C-Y> - accept current match
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
49 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
50 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
51 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
52
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
53 " <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
54 " 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
55 " This should according to the documentation:
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
56 " January
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
57 " but instead, this does
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
58 " Januar
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
59 " (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
60 " 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
61 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
62 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
63 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
64
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
65 " 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
66 " and insert the typed character
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
67 call feedkeys("a\<f5>20", 'tx')
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
68 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
69 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
70
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
71 " 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
72 " reduce number of matches
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
73 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
74 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
75 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
76
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
77 " 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
78 " reduce number of matches
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
79 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
80 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
81 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
82
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
83 " 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
84 " reduce number of matches
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
85 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
86 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
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 " <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
90 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
91 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
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>",3)."\<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(["J "], 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-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
100 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
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-y> - Accept current selected match
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
105 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
106 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
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 " <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
110 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
111 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
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> - 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>\<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([""], 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> - 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>\<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(["December"], 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 " <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
125 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
126 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
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> - 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>\<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(["November"], 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> - 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>\<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 " <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>\<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
141 call assert_equal([""], 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 " <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
145 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
146 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
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> - 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>\<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([""], 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> - 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>\<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(["December"], 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 " <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
160 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
161 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
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 " <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
165 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
166 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
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 " <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
170 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
171 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
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> - 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
175 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
176 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
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 " <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
180 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
181 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
182 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
183
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
184 " 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
185 " <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
186 call append(0, ["December2015"])
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
187 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
188 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
189 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
190
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
191 " use menuone for 'completeopt'
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
192 " 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
193 " three letters from the line above
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
194 set completeopt&vim
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
195 set completeopt+=menuone
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
196 call append(0, ["December2015"])
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
197 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
198 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
199 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
200
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
201 " use longest for 'completeopt'
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
202 set completeopt&vim
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
203 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
204 set completeopt+=longest
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
205 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
206 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
207 %d
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 " use noselect/noinsert for 'completeopt'
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
210 set completeopt&vim
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
211 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
212 set completeopt+=noselect
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
213 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
214 set completeopt-=noselect completeopt+=noinsert
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
215 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
216 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
217 %d
12566
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
218 set belloff&
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
219 endfu
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
220
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
221
9359
35b173e37dc6 commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
222 func! Test_popup_completion_insertmode()
9465
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
223 new
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
224 inoremap <F5> <C-R>=ListMonths()<CR>
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
225
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
226 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
227 call assert_equal('February', getline(1))
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 " Set noinsertmode
9465
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
230 let g:setting = 'noinsertmode'
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
231 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
232 call assert_equal('February', getline(1))
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
233 call assert_false(pumvisible())
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
234 %d
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
235 " 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
236 let g:setting = ''
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
237 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
238 call assert_equal('', getline(1))
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
239 %d
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
240 " select previous entry
9465
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
241 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
242 call assert_equal('', getline(1))
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
243 %d
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
244 " select last entry
9465
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
245 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
246 call assert_equal('December', getline(1))
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
247
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
248 iunmap <F5>
9359
35b173e37dc6 commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
249 endfunc
9465
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
250
10120
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
251 func Test_noinsert_complete()
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
252 function! s:complTest1() abort
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
253 call complete(1, ['source', 'soundfold'])
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
254 return ''
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
255 endfunction
9465
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
256
10120
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
257 function! s:complTest2() abort
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
258 call complete(1, ['source', 'soundfold'])
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
259 return ''
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
260 endfunction
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
261
9465
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
262 new
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
263 set completeopt+=noinsert
10120
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
264 inoremap <F5> <C-R>=s:complTest1()<CR>
9465
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
265 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
266 call assert_equal('soundfold', getline(1))
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
267 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
268 bwipe!
9465
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
269
9467
5fb484647e12 commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents: 9465
diff changeset
270 new
10120
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
271 inoremap <F5> <C-R>=s:complTest2()<CR>
9467
5fb484647e12 commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents: 9465
diff changeset
272 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
273 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
274 bwipe!
9467
5fb484647e12 commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents: 9465
diff changeset
275
9465
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
276 set completeopt-=noinsert
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
277 iunmap <F5>
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
278 endfunc
9467
5fb484647e12 commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents: 9465
diff changeset
279
10120
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
280 func Test_compl_vim_cmds_after_register_expr()
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
281 function! s:test_func()
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
282 return 'autocmd '
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
283 endfunction
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
284 augroup AAAAA_Group
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
285 au!
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
286 augroup END
9467
5fb484647e12 commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents: 9465
diff changeset
287
10120
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
288 new
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
289 call feedkeys("i\<c-r>=s:test_func()\<CR>\<C-x>\<C-v>\<Esc>", 'tx')
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
290 call assert_equal('autocmd AAAAA_Group', getline(1))
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
291 autocmd! AAAAA_Group
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
292 augroup! AAAAA_Group
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
293 bwipe!
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
294 endfunc
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
295
10277
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
296 func DummyCompleteOne(findstart, base)
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
297 if a:findstart
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
298 return 0
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
299 else
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
300 wincmd n
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
301 return ['onedef', 'oneDEF']
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
302 endif
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
303 endfunc
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
304
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
305 " Test that nothing happens if the 'completefunc' opens
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
306 " a new window (no completion, no crash)
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
307 func Test_completefunc_opens_new_window_one()
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
308 new
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
309 let winid = win_getid()
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
310 setlocal completefunc=DummyCompleteOne
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
311 call setline(1, 'one')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
312 /^one
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
313 call assert_fails('call feedkeys("A\<C-X>\<C-U>\<C-N>\<Esc>", "x")', 'E839:')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
314 call assert_notequal(winid, win_getid())
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
315 q!
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
316 call assert_equal(winid, win_getid())
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
317 call assert_equal('', getline(1))
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
318 q!
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
319 endfunc
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
320
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
321 " Test that nothing happens if the 'completefunc' opens
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
322 " a new window (no completion, no crash)
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
323 func DummyCompleteTwo(findstart, base)
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
324 if a:findstart
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
325 wincmd n
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
326 return 0
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
327 else
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
328 return ['twodef', 'twoDEF']
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
329 endif
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
330 endfunction
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
331
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
332 " Test that nothing happens if the 'completefunc' opens
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
333 " a new window (no completion, no crash)
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
334 func Test_completefunc_opens_new_window_two()
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
335 new
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
336 let winid = win_getid()
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
337 setlocal completefunc=DummyCompleteTwo
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
338 call setline(1, 'two')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
339 /^two
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
340 call assert_fails('call feedkeys("A\<C-X>\<C-U>\<C-N>\<Esc>", "x")', 'E764:')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
341 call assert_notequal(winid, win_getid())
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
342 q!
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
343 call assert_equal(winid, win_getid())
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
344 call assert_equal('two', getline(1))
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
345 q!
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
346 endfunc
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
347
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
348 func DummyCompleteThree(findstart, base)
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
349 if a:findstart
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
350 return 0
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
351 else
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
352 return ['threedef', 'threeDEF']
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
353 endif
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
354 endfunc
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
355
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
356 :"Test that 'completefunc' works when it's OK.
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
357 func Test_completefunc_works()
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
358 new
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
359 let winid = win_getid()
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
360 setlocal completefunc=DummyCompleteThree
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
361 call setline(1, 'three')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
362 /^three
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
363 call feedkeys("A\<C-X>\<C-U>\<C-N>\<Esc>", "x")
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
364 call assert_equal(winid, win_getid())
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
365 call assert_equal('threeDEF', getline(1))
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
366 q!
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
367 endfunc
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
368
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
369 func DummyCompleteFour(findstart, base)
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
370 if a:findstart
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
371 return 0
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
372 else
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
373 call complete_add('four1')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
374 call complete_add('four2')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
375 call complete_check()
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
376 call complete_add('four3')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
377 call complete_add('four4')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
378 call complete_check()
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
379 call complete_add('four5')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
380 call complete_add('four6')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
381 return []
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
382 endif
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
383 endfunc
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
384
10315
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
385 " Test that 'omnifunc' works when it's OK.
10277
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
386 func Test_omnifunc_with_check()
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
387 new
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
388 setlocal omnifunc=DummyCompleteFour
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
389 call setline(1, 'four')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
390 /^four
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
391 call feedkeys("A\<C-X>\<C-O>\<C-N>\<Esc>", "x")
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
392 call assert_equal('four2', getline(1))
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
393
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
394 call setline(1, 'four')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
395 /^four
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
396 call feedkeys("A\<C-X>\<C-O>\<C-N>\<C-N>\<Esc>", "x")
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
397 call assert_equal('four3', getline(1))
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
398
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
399 call setline(1, 'four')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
400 /^four
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
401 call feedkeys("A\<C-X>\<C-O>\<C-N>\<C-N>\<C-N>\<C-N>\<Esc>", "x")
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
402 call assert_equal('four5', getline(1))
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
403
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
404 q!
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
405 endfunc
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
406
10289
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
407 function UndoComplete()
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
408 call complete(1, ['January', 'February', 'March',
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
409 \ 'April', 'May', 'June', 'July', 'August', 'September',
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
410 \ 'October', 'November', 'December'])
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
411 return ''
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
412 endfunc
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
413
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
414 " Test that no undo item is created when no completion is inserted
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
415 func Test_complete_no_undo()
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
416 set completeopt=menu,preview,noinsert,noselect
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
417 inoremap <Right> <C-R>=UndoComplete()<CR>
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
418 new
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
419 call feedkeys("ixxx\<CR>\<CR>yyy\<Esc>k", 'xt')
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
420 call feedkeys("iaaa\<Esc>0", 'xt')
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
421 call assert_equal('aaa', getline(2))
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
422 call feedkeys("i\<Right>\<Esc>", 'xt')
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
423 call assert_equal('aaa', getline(2))
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
424 call feedkeys("u", 'xt')
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
425 call assert_equal('', getline(2))
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
426
10291
d9bd03a0d70f commit https://github.com/vim/vim/commit/cbd3bd6cbed5baf418b037b17ad46e339ff59174
Christian Brabandt <cb@256bit.org>
parents: 10289
diff changeset
427 call feedkeys("ibbb\<Esc>0", 'xt')
d9bd03a0d70f commit https://github.com/vim/vim/commit/cbd3bd6cbed5baf418b037b17ad46e339ff59174
Christian Brabandt <cb@256bit.org>
parents: 10289
diff changeset
428 call assert_equal('bbb', getline(2))
d9bd03a0d70f commit https://github.com/vim/vim/commit/cbd3bd6cbed5baf418b037b17ad46e339ff59174
Christian Brabandt <cb@256bit.org>
parents: 10289
diff changeset
429 call feedkeys("A\<Right>\<Down>\<CR>\<Esc>", 'xt')
d9bd03a0d70f commit https://github.com/vim/vim/commit/cbd3bd6cbed5baf418b037b17ad46e339ff59174
Christian Brabandt <cb@256bit.org>
parents: 10289
diff changeset
430 call assert_equal('January', getline(2))
d9bd03a0d70f commit https://github.com/vim/vim/commit/cbd3bd6cbed5baf418b037b17ad46e339ff59174
Christian Brabandt <cb@256bit.org>
parents: 10289
diff changeset
431 call feedkeys("u", 'xt')
d9bd03a0d70f commit https://github.com/vim/vim/commit/cbd3bd6cbed5baf418b037b17ad46e339ff59174
Christian Brabandt <cb@256bit.org>
parents: 10289
diff changeset
432 call assert_equal('bbb', getline(2))
d9bd03a0d70f commit https://github.com/vim/vim/commit/cbd3bd6cbed5baf418b037b17ad46e339ff59174
Christian Brabandt <cb@256bit.org>
parents: 10289
diff changeset
433
10293
0bf1d211e441 commit https://github.com/vim/vim/commit/9ec7fa82a2c4f0283862ed704c2940959e6130ee
Christian Brabandt <cb@256bit.org>
parents: 10291
diff changeset
434 call feedkeys("A\<Right>\<C-N>\<Esc>", 'xt')
0bf1d211e441 commit https://github.com/vim/vim/commit/9ec7fa82a2c4f0283862ed704c2940959e6130ee
Christian Brabandt <cb@256bit.org>
parents: 10291
diff changeset
435 call assert_equal('January', getline(2))
0bf1d211e441 commit https://github.com/vim/vim/commit/9ec7fa82a2c4f0283862ed704c2940959e6130ee
Christian Brabandt <cb@256bit.org>
parents: 10291
diff changeset
436 call feedkeys("u", 'xt')
0bf1d211e441 commit https://github.com/vim/vim/commit/9ec7fa82a2c4f0283862ed704c2940959e6130ee
Christian Brabandt <cb@256bit.org>
parents: 10291
diff changeset
437 call assert_equal('bbb', getline(2))
0bf1d211e441 commit https://github.com/vim/vim/commit/9ec7fa82a2c4f0283862ed704c2940959e6130ee
Christian Brabandt <cb@256bit.org>
parents: 10291
diff changeset
438
10289
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
439 iunmap <Right>
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
440 set completeopt&
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
441 q!
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
442 endfunc
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
443
10315
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
444 function! DummyCompleteFive(findstart, base)
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
445 if a:findstart
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
446 return 0
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
447 else
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
448 return [
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
449 \ { 'word': 'January', 'info': "info1-1\n1-2\n1-3" },
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
450 \ { 'word': 'February', 'info': "info2-1\n2-2\n2-3" },
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
451 \ { 'word': 'March', 'info': "info3-1\n3-2\n3-3" },
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
452 \ { 'word': 'April', 'info': "info4-1\n4-2\n4-3" },
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
453 \ { 'word': 'May', 'info': "info5-1\n5-2\n5-3" },
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
454 \ ]
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
455 endif
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
456 endfunc
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
457
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
458 " Test that 'completefunc' on Scratch buffer with preview window works when
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
459 " it's OK.
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
460 func Test_completefunc_with_scratch_buffer()
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
461 new +setlocal\ buftype=nofile\ bufhidden=wipe\ noswapfile
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
462 set completeopt+=preview
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
463 setlocal completefunc=DummyCompleteFive
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
464 call feedkeys("A\<C-X>\<C-U>\<C-N>\<C-N>\<C-N>\<Esc>", "x")
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
465 call assert_equal(['April'], getline(1, '$'))
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
466 pclose
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
467 q!
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
468 set completeopt&
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
469 endfunc
10289
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
470
10468
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
471 " <C-E> - select original typed text before the completion started without
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
472 " auto-wrap text.
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
473 func Test_completion_ctrl_e_without_autowrap()
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
474 new
10714
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
475 let tw_save = &tw
10468
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
476 set tw=78
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
477 let li = [
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
478 \ '" zzz',
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
479 \ '" zzzyyyyyyyyyyyyyyyyyyy']
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
480 call setline(1, li)
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
481 0
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
482 call feedkeys("A\<C-X>\<C-N>\<C-E>\<Esc>", "tx")
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
483 call assert_equal(li, getline(1, '$'))
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
484
10714
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
485 let &tw = tw_save
10468
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
486 q!
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
487 endfunc
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
488
10714
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
489 function! DummyCompleteSix()
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
490 call complete(1, ['Hello', 'World'])
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
491 return ''
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
492 endfunction
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
493
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
494 " complete() correctly clears the list of autocomplete candidates
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
495 " See #1411
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
496 func Test_completion_clear_candidate_list()
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
497 new
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
498 %d
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
499 " select first entry from the completion popup
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
500 call feedkeys("a xxx\<C-N>\<C-R>=DummyCompleteSix()\<CR>", "tx")
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
501 call assert_equal('Hello', getline(1))
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
502 %d
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
503 " select second entry from the completion popup
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
504 call feedkeys("a xxx\<C-N>\<C-R>=DummyCompleteSix()\<CR>\<C-N>", "tx")
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
505 call assert_equal('World', getline(1))
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
506 %d
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
507 " select original text
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
508 call feedkeys("a xxx\<C-N>\<C-R>=DummyCompleteSix()\<CR>\<C-N>\<C-N>", "tx")
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
509 call assert_equal(' xxx', getline(1))
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
510 %d
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
511 " back at first entry from completion list
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
512 call feedkeys("a xxx\<C-N>\<C-R>=DummyCompleteSix()\<CR>\<C-N>\<C-N>\<C-N>", "tx")
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
513 call assert_equal('Hello', getline(1))
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
514
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
515 bw!
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
516 endfunc
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
517
10859
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
518 func Test_completion_respect_bs_option()
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
519 new
12566
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
520 set belloff=all
10859
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
521 let li = ["aaa", "aaa12345", "aaaabcdef", "aaaABC"]
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
522
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
523 set bs=indent,eol
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
524 call setline(1, li)
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
525 1
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
526 call feedkeys("A\<C-X>\<C-N>\<C-P>\<BS>\<BS>\<BS>\<Esc>", "tx")
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
527 call assert_equal('aaa', getline(1))
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
528
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
529 %d
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
530 set bs=indent,eol,start
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
531 call setline(1, li)
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
532 1
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
533 call feedkeys("A\<C-X>\<C-N>\<C-P>\<BS>\<BS>\<BS>\<Esc>", "tx")
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
534 call assert_equal('', getline(1))
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
535
12566
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
536 set belloff&
10859
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
537 bw!
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
538 endfunc
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
539
10904
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
540 func CompleteUndo() abort
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
541 call complete(1, g:months)
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
542 return ''
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
543 endfunc
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
544
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
545 func Test_completion_can_undo()
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
546 inoremap <Right> <c-r>=CompleteUndo()<cr>
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
547 set completeopt+=noinsert,noselect
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
548
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
549 new
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
550 call feedkeys("a\<Right>a\<Esc>", 'xt')
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
551 call assert_equal('a', getline(1))
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
552 undo
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
553 call assert_equal('', getline(1))
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
554
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
555 bwipe!
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
556 set completeopt&
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
557 iunmap <Right>
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
558 endfunc
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
559
10916
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
560 func Test_completion_comment_formatting()
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
561 new
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
562 setl formatoptions=tcqro
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
563 call feedkeys("o/*\<cr>\<cr>/\<esc>", 'tx')
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
564 call assert_equal(['', '/*', ' *', ' */'], getline(1,4))
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
565 %d
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
566 call feedkeys("o/*\<cr>foobar\<cr>/\<esc>", 'tx')
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
567 call assert_equal(['', '/*', ' * foobar', ' */'], getline(1,4))
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
568 %d
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
569 try
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
570 call feedkeys("o/*\<cr>\<cr>\<c-x>\<c-u>/\<esc>", 'tx')
11183
1c4ebbae41d2 patch 8.0.0478: tests use assert_true(0) and assert_false(1) to report errors
Christian Brabandt <cb@256bit.org>
parents: 10916
diff changeset
571 call assert_report('completefunc not set, should have failed')
10916
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
572 catch
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
573 call assert_exception('E764:')
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
574 endtry
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
575 call assert_equal(['', '/*', ' *', ' */'], getline(1,4))
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
576 bwipe!
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
577 endfunc
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
578
11424
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
579 fun MessCompleteMonths()
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
580 for m in split("Jan Feb Mar Apr May Jun Jul Aug Sep")
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
581 call complete_add(m)
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
582 if complete_check()
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
583 break
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
584 endif
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
585 endfor
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
586 return []
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
587 endfun
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
588
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
589 fun MessCompleteMore()
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
590 call complete(1, split("Oct Nov Dec"))
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
591 return []
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
592 endfun
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
593
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
594 fun MessComplete(findstart, base)
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
595 if a:findstart
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
596 let line = getline('.')
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
597 let start = col('.') - 1
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
598 while start > 0 && line[start - 1] =~ '\a'
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
599 let start -= 1
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
600 endwhile
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
601 return start
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
602 else
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
603 call MessCompleteMonths()
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
604 call MessCompleteMore()
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
605 return []
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
606 endif
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
607 endf
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
608
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
609 func Test_complete_func_mess()
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
610 " Calling complete() after complete_add() in 'completefunc' is wrong, but it
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
611 " should not crash.
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
612 set completefunc=MessComplete
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
613 new
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
614 call setline(1, 'Ju')
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
615 call feedkeys("A\<c-x>\<c-u>/\<esc>", 'tx')
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
616 call assert_equal('Oct/Oct', getline(1))
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
617 bwipe!
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
618 set completefunc=
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
619 endfunc
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
620
11573
c8fd52807897 patch 8.0.0669: CTRL-N at start of the buffer does not work correctly
Christian Brabandt <cb@256bit.org>
parents: 11424
diff changeset
621 func Test_complete_CTRLN_startofbuffer()
c8fd52807897 patch 8.0.0669: CTRL-N at start of the buffer does not work correctly
Christian Brabandt <cb@256bit.org>
parents: 11424
diff changeset
622 new
12566
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
623 set belloff=all
11573
c8fd52807897 patch 8.0.0669: CTRL-N at start of the buffer does not work correctly
Christian Brabandt <cb@256bit.org>
parents: 11424
diff changeset
624 call setline(1, [ 'organize(cupboard, 3, 2);',
c8fd52807897 patch 8.0.0669: CTRL-N at start of the buffer does not work correctly
Christian Brabandt <cb@256bit.org>
parents: 11424
diff changeset
625 \ 'prioritize(bureau, 8, 7);',
c8fd52807897 patch 8.0.0669: CTRL-N at start of the buffer does not work correctly
Christian Brabandt <cb@256bit.org>
parents: 11424
diff changeset
626 \ 'realize(bannister, 4, 4);',
c8fd52807897 patch 8.0.0669: CTRL-N at start of the buffer does not work correctly
Christian Brabandt <cb@256bit.org>
parents: 11424
diff changeset
627 \ 'moralize(railing, 3,9);'])
c8fd52807897 patch 8.0.0669: CTRL-N at start of the buffer does not work correctly
Christian Brabandt <cb@256bit.org>
parents: 11424
diff changeset
628 let expected=['cupboard.organize(3, 2);',
c8fd52807897 patch 8.0.0669: CTRL-N at start of the buffer does not work correctly
Christian Brabandt <cb@256bit.org>
parents: 11424
diff changeset
629 \ 'bureau.prioritize(8, 7);',
c8fd52807897 patch 8.0.0669: CTRL-N at start of the buffer does not work correctly
Christian Brabandt <cb@256bit.org>
parents: 11424
diff changeset
630 \ 'bannister.realize(4, 4);',
c8fd52807897 patch 8.0.0669: CTRL-N at start of the buffer does not work correctly
Christian Brabandt <cb@256bit.org>
parents: 11424
diff changeset
631 \ 'railing.moralize(3,9);']
c8fd52807897 patch 8.0.0669: CTRL-N at start of the buffer does not work correctly
Christian Brabandt <cb@256bit.org>
parents: 11424
diff changeset
632 call feedkeys("qai\<c-n>\<c-n>.\<esc>3wdW\<cr>q3@a", 'tx')
c8fd52807897 patch 8.0.0669: CTRL-N at start of the buffer does not work correctly
Christian Brabandt <cb@256bit.org>
parents: 11424
diff changeset
633 call assert_equal(expected, getline(1,'$'))
12566
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
634 set belloff&
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
635 bwipe!
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
636 endfunc
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
637
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
638 func Test_popup_and_window_resize()
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
639 if !has('terminal') || has('gui_running')
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
640 return
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
641 endif
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
642 let h = winheight(0)
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
643 if h < 15
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
644 return
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
645 endif
12602
9359ed49d375 patch 8.0.1179: Test_popup_and_window_resize() does not always pass
Christian Brabandt <cb@256bit.org>
parents: 12586
diff changeset
646 let g:buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], {'term_rows': h / 3})
9359ed49d375 patch 8.0.1179: Test_popup_and_window_resize() does not always pass
Christian Brabandt <cb@256bit.org>
parents: 12586
diff changeset
647 call term_sendkeys(g:buf, (h / 3 - 1)."o\<esc>")
12586
0d29a806e6d1 patch 8.0.1171: popup test is still a bit flaky
Christian Brabandt <cb@256bit.org>
parents: 12574
diff changeset
648 call term_wait(g:buf, 200)
12602
9359ed49d375 patch 8.0.1179: Test_popup_and_window_resize() does not always pass
Christian Brabandt <cb@256bit.org>
parents: 12586
diff changeset
649 call term_sendkeys(g:buf, "Gi\<c-x>")
12566
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
650 call term_sendkeys(g:buf, "\<c-v>")
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
651 call term_wait(g:buf, 100)
12574
575d530df053 patch 8.0.1165: popup test is still flaky
Christian Brabandt <cb@256bit.org>
parents: 12570
diff changeset
652 " popup first entry "!" must be at the top
12570
871dc52ee7d7 patch 8.0.1163: popup test is flaky
Christian Brabandt <cb@256bit.org>
parents: 12566
diff changeset
653 call WaitFor('term_getline(g:buf, 1) =~ "^!"')
12566
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
654 call assert_match('^!\s*$', term_getline(g:buf, 1))
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
655 exe 'resize +' . (h - 1)
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
656 call term_wait(g:buf, 100)
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
657 redraw!
12574
575d530df053 patch 8.0.1165: popup test is still flaky
Christian Brabandt <cb@256bit.org>
parents: 12570
diff changeset
658 " popup shifted down, first line is now empty
12570
871dc52ee7d7 patch 8.0.1163: popup test is flaky
Christian Brabandt <cb@256bit.org>
parents: 12566
diff changeset
659 call WaitFor('term_getline(g:buf, 1) == ""')
12566
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
660 call assert_equal('', term_getline(g:buf, 1))
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
661 sleep 100m
12574
575d530df053 patch 8.0.1165: popup test is still flaky
Christian Brabandt <cb@256bit.org>
parents: 12570
diff changeset
662 " popup is below cursor line and shows first match "!"
12570
871dc52ee7d7 patch 8.0.1163: popup test is flaky
Christian Brabandt <cb@256bit.org>
parents: 12566
diff changeset
663 call WaitFor('term_getline(g:buf, term_getcursor(g:buf)[0] + 1) =~ "^!"')
12566
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
664 call assert_match('^!\s*$', term_getline(g:buf, term_getcursor(g:buf)[0] + 1))
12574
575d530df053 patch 8.0.1165: popup test is still flaky
Christian Brabandt <cb@256bit.org>
parents: 12570
diff changeset
665 " cursor line also shows !
575d530df053 patch 8.0.1165: popup test is still flaky
Christian Brabandt <cb@256bit.org>
parents: 12570
diff changeset
666 call assert_match('^!\s*$', term_getline(g:buf, term_getcursor(g:buf)[0]))
11573
c8fd52807897 patch 8.0.0669: CTRL-N at start of the buffer does not work correctly
Christian Brabandt <cb@256bit.org>
parents: 11424
diff changeset
667 bwipe!
c8fd52807897 patch 8.0.0669: CTRL-N at start of the buffer does not work correctly
Christian Brabandt <cb@256bit.org>
parents: 11424
diff changeset
668 endfunc
11424
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
669
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
670 " vim: shiftwidth=2 sts=2 expandtab