annotate src/testdir/test_popup.vim @ 10289:af5b6efad23f v8.0.0041

commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 16 15:35:47 2016 +0200 patch 8.0.0041 Problem: When using Insert mode completion but not actually inserting anything an undo item is still created. (Tommy Allen) Solution: Do not call stop_arrow() when not inserting anything.
author Christian Brabandt <cb@256bit.org>
date Sun, 16 Oct 2016 15:45:04 +0200
parents 154d5a2e7395
children d9bd03a0d70f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9359
35b173e37dc6 commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test for completion menu
35b173e37dc6 commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
35b173e37dc6 commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 let g:months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
35b173e37dc6 commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 let g:setting = ''
35b173e37dc6 commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
6 func! ListMonths()
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
7 if g:setting != ''
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
8 exe ":set" g:setting
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
9 endif
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
10 let mth=copy(g:months)
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
11 let entered = strcharpart(getline('.'),0,col('.'))
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
12 if !empty(entered)
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
13 let mth=filter(mth, 'v:val=~"^".entered')
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
14 endif
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
15 call complete(1, mth)
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
16 return ''
9359
35b173e37dc6 commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 endfunc
35b173e37dc6 commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18
10100
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9826
diff changeset
19 func! Test_popup_complete2()
10216
c41e1736ad47 commit https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880
Christian Brabandt <cb@256bit.org>
parents: 10120
diff changeset
20 " 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
21 " 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
22 " 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
23 " 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
24 " 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
25 " 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
26 new
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9826
diff changeset
27 inoremap <f5> <c-r>=ListMonths()<cr>
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9826
diff changeset
28 call append(1, ["December2015"])
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9826
diff changeset
29 :1
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9826
diff changeset
30 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
31 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
32 %d
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9826
diff changeset
33 bw!
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9826
diff changeset
34 endfu
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9826
diff changeset
35
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
36 func! Test_popup_complete()
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
37 new
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
38 inoremap <f5> <c-r>=ListMonths()<cr>
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
39
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
40 " <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
41 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
42 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
43 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
44
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
45 " <C-Y> - accept current match
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
46 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
47 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
48 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
49
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
50 " <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
51 " 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
52 " This should according to the documentation:
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
53 " January
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
54 " but instead, this does
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
55 " Januar
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
56 " (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
57 " 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
58 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
59 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
60 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
61
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
62 " 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
63 " and insert the typed character
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
64 call feedkeys("a\<f5>20", 'tx')
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
65 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
66 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
67
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
68 " 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
69 " reduce number of matches
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
70 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
71 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
72 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
73
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
74 " 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
75 " reduce number of matches
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
76 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
77 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
78 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
79
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
80 " 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
81 " reduce number of matches
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
82 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
83 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
84 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
85
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
86 " <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
87 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
88 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
89 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
90
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
91 " <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
92 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
93 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
94 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
95
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
96 " <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
97 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
98 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
99 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
100
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
101 " <c-y> - Accept current selected match
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
102 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
103 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
104 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
105
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
106 " <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
107 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
108 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
109 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
110
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
111 " <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
112 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
113 call assert_equal([""], getline(1,2))
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
114 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
115
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
116 " <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
117 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
118 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
119 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
120
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
121 " <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
122 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
123 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
124 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
125
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
126 " <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
127 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
128 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
129 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
130
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
131 " <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
132 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
133 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
134 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
135
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
136 " <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
137 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
138 call assert_equal([""], getline(1,2))
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
139 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
140
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
141 " <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
142 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
143 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
144 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
145
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
146 " <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
147 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
148 call assert_equal([""], getline(1,2))
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
149 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
150
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
151 " <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
152 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
153 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
154 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
155
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
156 " <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
157 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
158 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
159 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
160
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
161 " <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
162 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
163 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
164 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
165
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
166 " <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
167 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
168 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
169 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
170
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
171 " <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
172 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
173 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
174 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
175
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
176 " <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
177 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
178 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
179 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
180
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
181 " 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
182 " <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
183 call append(0, ["December2015"])
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
184 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
185 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
186 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
187
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
188 " use menuone for 'completeopt'
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
189 " 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
190 " three letters from the line above
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
191 set completeopt&vim
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
192 set completeopt+=menuone
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
193 call append(0, ["December2015"])
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
194 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
195 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
196 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
197
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
198 " use longest for 'completeopt'
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
199 set completeopt&vim
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
200 call feedkeys("aM\<f5>\<C-N>\<C-P>\<c-e>\<enter>\<esc>", 'tx')
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
201 set completeopt+=longest
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
202 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
203 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
204 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
205
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
206 " use noselect/noinsert for 'completeopt'
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
207 set completeopt&vim
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
208 call feedkeys("aM\<f5>\<enter>\<esc>", 'tx')
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
209 set completeopt+=noselect
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
210 call feedkeys("aM\<f5>\<enter>\<esc>", 'tx')
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
211 set completeopt-=noselect completeopt+=noinsert
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
212 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
213 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
214 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
215 endfu
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
216
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
217
9359
35b173e37dc6 commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
218 func! Test_popup_completion_insertmode()
9465
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
219 new
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
220 inoremap <F5> <C-R>=ListMonths()<CR>
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
221
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
222 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
223 call assert_equal('February', getline(1))
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
224 %d
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
225 " Set noinsertmode
9465
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
226 let g:setting = 'noinsertmode'
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
227 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
228 call assert_equal('February', getline(1))
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
229 call assert_false(pumvisible())
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
230 %d
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
231 " 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
232 let g:setting = ''
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
233 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
234 call assert_equal('', getline(1))
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
235 %d
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
236 " select previous entry
9465
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
237 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
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 last 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>\<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('December', getline(1))
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
243
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
244 iunmap <F5>
9359
35b173e37dc6 commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
245 endfunc
9465
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
246
10120
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
247 func Test_noinsert_complete()
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
248 function! s:complTest1() abort
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
249 call complete(1, ['source', 'soundfold'])
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
250 return ''
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
251 endfunction
9465
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
252
10120
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
253 function! s:complTest2() abort
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
254 call complete(1, ['source', 'soundfold'])
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
255 return ''
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
256 endfunction
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
257
9465
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
258 new
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
259 set completeopt+=noinsert
10120
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
260 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
261 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
262 call assert_equal('soundfold', getline(1))
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
263 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
264 bwipe!
9465
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
265
9467
5fb484647e12 commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents: 9465
diff changeset
266 new
10120
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
267 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
268 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
269 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
270 bwipe!
9467
5fb484647e12 commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents: 9465
diff changeset
271
9465
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
272 set completeopt-=noinsert
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
273 iunmap <F5>
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
274 endfunc
9467
5fb484647e12 commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents: 9465
diff changeset
275
10120
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
276 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
277 function! s:test_func()
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
278 return 'autocmd '
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
279 endfunction
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
280 augroup AAAAA_Group
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
281 au!
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
282 augroup END
9467
5fb484647e12 commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents: 9465
diff changeset
283
10120
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
284 new
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
285 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
286 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
287 autocmd! AAAAA_Group
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
288 augroup! AAAAA_Group
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
289 bwipe!
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
290 endfunc
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
291
10277
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
292 func DummyCompleteOne(findstart, base)
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
293 if a:findstart
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
294 return 0
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
295 else
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
296 wincmd n
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
297 return ['onedef', 'oneDEF']
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
298 endif
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
299 endfunc
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
300
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
301 " 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
302 " 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
303 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
304 new
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
305 let winid = win_getid()
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
306 setlocal completefunc=DummyCompleteOne
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
307 call setline(1, 'one')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
308 /^one
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
309 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
310 call assert_notequal(winid, win_getid())
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
311 q!
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
312 call assert_equal(winid, win_getid())
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
313 call assert_equal('', getline(1))
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
314 q!
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
315 endfunc
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
316
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
317 " 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
318 " 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
319 func DummyCompleteTwo(findstart, base)
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
320 if a:findstart
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
321 wincmd n
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
322 return 0
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
323 else
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
324 return ['twodef', 'twoDEF']
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
325 endif
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
326 endfunction
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
327
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
328 " 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
329 " 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
330 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
331 new
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
332 let winid = win_getid()
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
333 setlocal completefunc=DummyCompleteTwo
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
334 call setline(1, 'two')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
335 /^two
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
336 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
337 call assert_notequal(winid, win_getid())
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
338 q!
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
339 call assert_equal(winid, win_getid())
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
340 call assert_equal('two', getline(1))
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
341 q!
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
342 endfunc
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
343
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
344 func DummyCompleteThree(findstart, base)
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
345 if a:findstart
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
346 return 0
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
347 else
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
348 return ['threedef', 'threeDEF']
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
349 endif
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
350 endfunc
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
351
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
352 :"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
353 func Test_completefunc_works()
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
354 new
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
355 let winid = win_getid()
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
356 setlocal completefunc=DummyCompleteThree
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
357 call setline(1, 'three')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
358 /^three
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
359 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
360 call assert_equal(winid, win_getid())
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
361 call assert_equal('threeDEF', getline(1))
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
362 q!
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
363 endfunc
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
364
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
365 func DummyCompleteFour(findstart, base)
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
366 if a:findstart
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
367 return 0
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
368 else
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
369 call complete_add('four1')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
370 call complete_add('four2')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
371 call complete_check()
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
372 call complete_add('four3')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
373 call complete_add('four4')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
374 call complete_check()
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
375 call complete_add('four5')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
376 call complete_add('four6')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
377 return []
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
378 endif
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
379 endfunc
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
380
10289
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
381 " Test that 'completefunc' works when it's OK.
10277
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
382 func Test_omnifunc_with_check()
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
383 new
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
384 setlocal omnifunc=DummyCompleteFour
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
385 call setline(1, 'four')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
386 /^four
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
387 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
388 call assert_equal('four2', getline(1))
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
389
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
390 call setline(1, 'four')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
391 /^four
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
392 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
393 call assert_equal('four3', getline(1))
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
394
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
395 call setline(1, 'four')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
396 /^four
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
397 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
398 call assert_equal('four5', getline(1))
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
399
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
400 q!
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
401 endfunc
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
402
10289
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
403 function UndoComplete()
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
404 call complete(1, ['January', 'February', 'March',
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
405 \ 'April', 'May', 'June', 'July', 'August', 'September',
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
406 \ 'October', 'November', 'December'])
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
407 return ''
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
408 endfunc
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
409
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
410 " 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
411 func Test_complete_no_undo()
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
412 set completeopt=menu,preview,noinsert,noselect
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
413 inoremap <Right> <C-R>=UndoComplete()<CR>
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
414 new
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
415 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
416 call feedkeys("iaaa\<Esc>0", 'xt')
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
417 call assert_equal('aaa', getline(2))
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
418 call feedkeys("i\<Right>\<Esc>", 'xt')
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
419 call assert_equal('aaa', getline(2))
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
420 call feedkeys("u", 'xt')
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
421 call assert_equal('', getline(2))
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
422
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
423 iunmap <Right>
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
424 set completeopt&
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
425 q!
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
426 endfunc
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
427
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
428
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
429 " vim: shiftwidth=2 sts=2 expandtab