annotate src/testdir/test_popup.vim @ 25028:faa3de7aed8b v8.2.3051

patch 8.2.3051: Vim9: for loop with one list variable does not work Commit: https://github.com/vim/vim/commit/444d878324525787e55185ce3c3e29a3de9b700a Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 26 12:40:56 2021 +0200 patch 8.2.3051: Vim9: for loop with one list variable does not work Problem: Vim9: for loop with one list variable does not work. Solution: Use a separate flag for unpacking a list. (closes https://github.com/vim/vim/issues/8452)
author Bram Moolenaar <Bram@vim.org>
date Sat, 26 Jun 2021 12:45:03 +0200
parents a84ed6d4aa9f
children 6776d3fbf13b
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
13329
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
4 source screendump.vim
17657
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
5 source check.vim
12566
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
6
9359
35b173e37dc6 commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 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
8 let g:setting = ''
35b173e37dc6 commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9
14055
ac5265f7d1c7 patch 8.1.0045: popup test isn't run completely
Christian Brabandt <cb@256bit.org>
parents: 14041
diff changeset
10 func ListMonths()
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
11 if g:setting != ''
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
12 exe ":set" g:setting
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
13 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
14 let mth = copy(g:months)
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
15 let entered = strcharpart(getline('.'),0,col('.'))
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
16 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
17 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
18 endif
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
19 call complete(1, mth)
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
20 return ''
9359
35b173e37dc6 commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 endfunc
35b173e37dc6 commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22
14055
ac5265f7d1c7 patch 8.1.0045: popup test isn't run completely
Christian Brabandt <cb@256bit.org>
parents: 14041
diff changeset
23 func Test_popup_complete2()
10216
c41e1736ad47 commit https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880
Christian Brabandt <cb@256bit.org>
parents: 10120
diff changeset
24 " 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
25 " 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
26 " 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
27 " 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
28 " 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
29 " 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
30 new
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9826
diff changeset
31 inoremap <f5> <c-r>=ListMonths()<cr>
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9826
diff changeset
32 call append(1, ["December2015"])
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9826
diff changeset
33 :1
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9826
diff changeset
34 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
35 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
36 %d
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9826
diff changeset
37 bw!
14055
ac5265f7d1c7 patch 8.1.0045: popup test isn't run completely
Christian Brabandt <cb@256bit.org>
parents: 14041
diff changeset
38 endfunc
10100
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9826
diff changeset
39
14055
ac5265f7d1c7 patch 8.1.0045: popup test isn't run completely
Christian Brabandt <cb@256bit.org>
parents: 14041
diff changeset
40 func Test_popup_complete()
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
41 new
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
42 inoremap <f5> <c-r>=ListMonths()<cr>
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
43
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
44 " <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
45 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
46 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
47 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
48
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
49 " <C-Y> - accept current match
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
50 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
51 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
52 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
53
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
54 " <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
55 " 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
56 " This should according to the documentation:
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
57 " January
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
58 " but instead, this does
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
59 " Januar
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
60 " (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
61 " 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
62 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
63 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
64 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
65
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
66 " any-non 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
67 " and insert the typed character
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
68 call feedkeys("a\<f5>20", 'tx')
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
69 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
70 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
71
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
72 " any-non printable, non-white character: Add this character and
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
73 " reduce number of matches
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
74 call feedkeys("aJu\<f5>\<c-p>l\<c-y>", 'tx')
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
75 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
76 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
77
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
78 " any-non printable, non-white character: Add this character and
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
79 " reduce number of matches
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
80 call feedkeys("aJu\<f5>\<c-p>l\<c-n>\<c-y>", 'tx')
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
81 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
82 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
83
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
84 " 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
85 " reduce number of matches
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
86 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
87 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
88 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
89
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
90 " <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
91 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
92 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
93 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
94
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
95 " <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
96 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
97 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
98 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
99
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
100 " <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
101 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
102 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
103 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
104
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
105 " <c-y> - Accept current selected match
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
106 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
107 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
108 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
109
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
110 " <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
111 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
112 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
113 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
114
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
115 " <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
116 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
117 call assert_equal([""], getline(1,2))
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
118 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
119
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
120 " <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
121 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
122 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
123 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
124
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
125 " <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
126 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
127 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
128 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
129
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
130 " <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
131 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
132 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
133 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
134
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
135 " <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
136 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
137 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
138 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
139
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
140 " <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
141 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
142 call assert_equal([""], getline(1,2))
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
143 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
144
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
145 " <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
146 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
147 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
148 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
149
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
150 " <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
151 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
152 call assert_equal([""], getline(1,2))
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
153 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
154
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
155 " <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
156 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
157 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
158 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
159
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
160 " <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
161 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
162 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
163 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
164
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
165 " <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
166 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
167 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
168 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
169
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
170 " <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
171 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
172 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
173 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
174
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
175 " <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
176 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
177 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
178 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
179
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
180 " <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
181 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
182 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
183 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
184
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
185 " 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
186 " <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
187 call append(0, ["December2015"])
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
188 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
189 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
190 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
191
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
192 " use menuone for 'completeopt'
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
193 " 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
194 " three letters from the line above
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
195 set completeopt&vim
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
196 set completeopt+=menuone
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
197 call append(0, ["December2015"])
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
198 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
199 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
200 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
201
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
202 " use longest for 'completeopt'
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
203 set completeopt&vim
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
204 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
205 set completeopt+=longest
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
206 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
207 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
208 %d
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
209
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
210 " use noselect/noinsert for 'completeopt'
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
211 set completeopt&vim
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 set completeopt+=noselect
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
214 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
215 set completeopt-=noselect completeopt+=noinsert
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
216 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
217 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
218 %d
14055
ac5265f7d1c7 patch 8.1.0045: popup test isn't run completely
Christian Brabandt <cb@256bit.org>
parents: 14041
diff changeset
219 endfunc
9742
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
14055
ac5265f7d1c7 patch 8.1.0045: popup test isn't run completely
Christian Brabandt <cb@256bit.org>
parents: 14041
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()
14055
ac5265f7d1c7 patch 8.1.0045: popup test isn't run completely
Christian Brabandt <cb@256bit.org>
parents: 14041
diff changeset
252 func! s:complTest1() abort
17837
f71ee7b04f0b patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17783
diff changeset
253 eval ['source', 'soundfold']->complete(1)
10120
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
254 return ''
14055
ac5265f7d1c7 patch 8.1.0045: popup test isn't run completely
Christian Brabandt <cb@256bit.org>
parents: 14041
diff changeset
255 endfunc
9465
203792348947 commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
256
14055
ac5265f7d1c7 patch 8.1.0045: popup test isn't run completely
Christian Brabandt <cb@256bit.org>
parents: 14041
diff changeset
257 func! s:complTest2() abort
10120
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 ''
14055
ac5265f7d1c7 patch 8.1.0045: popup test isn't run completely
Christian Brabandt <cb@256bit.org>
parents: 14041
diff changeset
260 endfunc
10120
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
16237
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
280 func Test_complete_no_filter()
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
281 func! s:complTest1() abort
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
282 call complete(1, [{'word': 'foobar'}])
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
283 return ''
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
284 endfunc
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
285 func! s:complTest2() abort
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
286 call complete(1, [{'word': 'foobar', 'equal': 1}])
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
287 return ''
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
288 endfunc
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
289
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
290 let completeopt = &completeopt
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
291
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
292 " without equal=1
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
293 new
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
294 set completeopt=menuone,noinsert,menu
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
295 inoremap <F5> <C-R>=s:complTest1()<CR>
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
296 call feedkeys("i\<F5>z\<CR>\<CR>\<ESC>.", 'tx')
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
297 call assert_equal('z', getline(1))
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
298 bwipe!
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
299
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
300 " with equal=1
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
301 new
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
302 set completeopt=menuone,noinsert,menu
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
303 inoremap <F5> <C-R>=s:complTest2()<CR>
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
304 call feedkeys("i\<F5>z\<CR>\<CR>\<ESC>.", 'tx')
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
305 call assert_equal('foobar', getline(1))
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
306 bwipe!
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
307
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
308 let &completeopt = completeopt
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
309 iunmap <F5>
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
310 endfunc
56451a2677dc patch 8.1.1123: no way to avoid filtering for autocomplete function
Bram Moolenaar <Bram@vim.org>
parents: 16127
diff changeset
311
10120
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
312 func Test_compl_vim_cmds_after_register_expr()
14055
ac5265f7d1c7 patch 8.1.0045: popup test isn't run completely
Christian Brabandt <cb@256bit.org>
parents: 14041
diff changeset
313 func! s:test_func()
10120
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
314 return 'autocmd '
14055
ac5265f7d1c7 patch 8.1.0045: popup test isn't run completely
Christian Brabandt <cb@256bit.org>
parents: 14041
diff changeset
315 endfunc
10120
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
316 augroup AAAAA_Group
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
317 au!
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
318 augroup END
9467
5fb484647e12 commit https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd
Christian Brabandt <cb@256bit.org>
parents: 9465
diff changeset
319
10120
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
320 new
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
321 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
322 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
323 autocmd! AAAAA_Group
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
324 augroup! AAAAA_Group
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
325 bwipe!
fb040c9d8ce9 commit https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249
Christian Brabandt <cb@256bit.org>
parents: 10100
diff changeset
326 endfunc
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
327
10277
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
328 func DummyCompleteOne(findstart, base)
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
329 if a:findstart
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
330 return 0
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
331 else
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
332 wincmd n
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
333 return ['onedef', 'oneDEF']
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
334 endif
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
335 endfunc
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
336
20118
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
337 " Test that nothing happens if the 'completefunc' tries to open
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
338 " a new window (fails to open window, continues)
10277
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
339 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
340 new
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
341 let winid = win_getid()
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
342 setlocal completefunc=DummyCompleteOne
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
343 call setline(1, 'one')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
344 /^one
23770
385d33dfb7df patch 8.2.2426: allowing 'completefunc' to switch windows causes trouble
Bram Moolenaar <Bram@vim.org>
parents: 23328
diff changeset
345 call assert_fails('call feedkeys("A\<C-X>\<C-U>\<C-N>\<Esc>", "x")', 'E565:')
10277
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
346 call assert_equal(winid, win_getid())
22742
f7f2d73ff85e patch 8.2.1919: assert_fails() setting emsg_silent changes normal execution
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
347 call assert_equal('onedef', getline(1))
10277
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
348 q!
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
349 endfunc
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
350
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
351 " 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
352 " 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
353 func DummyCompleteTwo(findstart, base)
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
354 if a:findstart
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
355 wincmd n
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
356 return 0
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
357 else
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
358 return ['twodef', 'twoDEF']
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
359 endif
14055
ac5265f7d1c7 patch 8.1.0045: popup test isn't run completely
Christian Brabandt <cb@256bit.org>
parents: 14041
diff changeset
360 endfunc
10277
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
361
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
362 " 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
363 " 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
364 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
365 new
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
366 let winid = win_getid()
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
367 setlocal completefunc=DummyCompleteTwo
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
368 call setline(1, 'two')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
369 /^two
23772
f5225486d3de patch 8.2.2427: can still switch windows for 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 23770
diff changeset
370 call assert_fails('call feedkeys("A\<C-X>\<C-U>\<C-N>\<Esc>", "x")', 'E565:')
10277
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
371 call assert_equal(winid, win_getid())
23772
f5225486d3de patch 8.2.2427: can still switch windows for 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 23770
diff changeset
372 call assert_equal('twodef', getline(1))
10277
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
373 q!
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
374 endfunc
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
375
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
376 func DummyCompleteThree(findstart, base)
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
377 if a:findstart
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
378 return 0
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
379 else
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
380 return ['threedef', 'threeDEF']
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
381 endif
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
382 endfunc
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
383
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
384 :"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
385 func Test_completefunc_works()
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
386 new
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
387 let winid = win_getid()
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
388 setlocal completefunc=DummyCompleteThree
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
389 call setline(1, 'three')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
390 /^three
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-U>\<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(winid, win_getid())
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
393 call assert_equal('threeDEF', getline(1))
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
394 q!
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
395 endfunc
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
396
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
397 func DummyCompleteFour(findstart, base)
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
398 if a:findstart
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
399 return 0
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
400 else
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
401 call complete_add('four1')
17837
f71ee7b04f0b patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17783
diff changeset
402 eval 'four2'->complete_add()
10277
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
403 call complete_check()
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
404 call complete_add('four3')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
405 call complete_add('four4')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
406 call complete_check()
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
407 call complete_add('four5')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
408 call complete_add('four6')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
409 return []
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
410 endif
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
411 endfunc
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
412
10315
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
413 " 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
414 func Test_omnifunc_with_check()
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
415 new
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
416 setlocal omnifunc=DummyCompleteFour
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
417 call setline(1, 'four')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
418 /^four
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
419 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
420 call assert_equal('four2', getline(1))
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
421
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
422 call setline(1, 'four')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
423 /^four
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
424 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
425 call assert_equal('four3', getline(1))
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
426
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
427 call setline(1, 'four')
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
428 /^four
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
429 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
430 call assert_equal('four5', getline(1))
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
431
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
432 q!
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
433 endfunc
154d5a2e7395 commit https://github.com/vim/vim/commit/472e85970ee3a80abd824bef510df12e9cfe9e96
Christian Brabandt <cb@256bit.org>
parents: 10216
diff changeset
434
14055
ac5265f7d1c7 patch 8.1.0045: popup test isn't run completely
Christian Brabandt <cb@256bit.org>
parents: 14041
diff changeset
435 func UndoComplete()
10289
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
436 call complete(1, ['January', 'February', 'March',
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
437 \ 'April', 'May', 'June', 'July', 'August', 'September',
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
438 \ 'October', 'November', 'December'])
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
439 return ''
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
440 endfunc
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
441
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
442 " 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
443 func Test_complete_no_undo()
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
444 set completeopt=menu,preview,noinsert,noselect
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
445 inoremap <Right> <C-R>=UndoComplete()<CR>
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
446 new
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
447 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
448 call feedkeys("iaaa\<Esc>0", 'xt')
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
449 call assert_equal('aaa', getline(2))
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
450 call feedkeys("i\<Right>\<Esc>", 'xt')
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
451 call assert_equal('aaa', getline(2))
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
452 call feedkeys("u", 'xt')
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
453 call assert_equal('', getline(2))
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
454
10291
d9bd03a0d70f commit https://github.com/vim/vim/commit/cbd3bd6cbed5baf418b037b17ad46e339ff59174
Christian Brabandt <cb@256bit.org>
parents: 10289
diff changeset
455 call feedkeys("ibbb\<Esc>0", 'xt')
d9bd03a0d70f commit https://github.com/vim/vim/commit/cbd3bd6cbed5baf418b037b17ad46e339ff59174
Christian Brabandt <cb@256bit.org>
parents: 10289
diff changeset
456 call assert_equal('bbb', getline(2))
d9bd03a0d70f commit https://github.com/vim/vim/commit/cbd3bd6cbed5baf418b037b17ad46e339ff59174
Christian Brabandt <cb@256bit.org>
parents: 10289
diff changeset
457 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
458 call assert_equal('January', getline(2))
d9bd03a0d70f commit https://github.com/vim/vim/commit/cbd3bd6cbed5baf418b037b17ad46e339ff59174
Christian Brabandt <cb@256bit.org>
parents: 10289
diff changeset
459 call feedkeys("u", 'xt')
d9bd03a0d70f commit https://github.com/vim/vim/commit/cbd3bd6cbed5baf418b037b17ad46e339ff59174
Christian Brabandt <cb@256bit.org>
parents: 10289
diff changeset
460 call assert_equal('bbb', getline(2))
d9bd03a0d70f commit https://github.com/vim/vim/commit/cbd3bd6cbed5baf418b037b17ad46e339ff59174
Christian Brabandt <cb@256bit.org>
parents: 10289
diff changeset
461
10293
0bf1d211e441 commit https://github.com/vim/vim/commit/9ec7fa82a2c4f0283862ed704c2940959e6130ee
Christian Brabandt <cb@256bit.org>
parents: 10291
diff changeset
462 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
463 call assert_equal('January', getline(2))
0bf1d211e441 commit https://github.com/vim/vim/commit/9ec7fa82a2c4f0283862ed704c2940959e6130ee
Christian Brabandt <cb@256bit.org>
parents: 10291
diff changeset
464 call feedkeys("u", 'xt')
0bf1d211e441 commit https://github.com/vim/vim/commit/9ec7fa82a2c4f0283862ed704c2940959e6130ee
Christian Brabandt <cb@256bit.org>
parents: 10291
diff changeset
465 call assert_equal('bbb', getline(2))
0bf1d211e441 commit https://github.com/vim/vim/commit/9ec7fa82a2c4f0283862ed704c2940959e6130ee
Christian Brabandt <cb@256bit.org>
parents: 10291
diff changeset
466
10289
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
467 iunmap <Right>
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
468 set completeopt&
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
469 q!
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
470 endfunc
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
471
14055
ac5265f7d1c7 patch 8.1.0045: popup test isn't run completely
Christian Brabandt <cb@256bit.org>
parents: 14041
diff changeset
472 func DummyCompleteFive(findstart, base)
10315
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
473 if a:findstart
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
474 return 0
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
475 else
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
476 return [
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
477 \ { '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
478 \ { '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
479 \ { '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
480 \ { '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
481 \ { '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
482 \ ]
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
483 endif
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
484 endfunc
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
485
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
486 " 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
487 " it's OK.
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
488 func Test_completefunc_with_scratch_buffer()
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18667
diff changeset
489 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18667
diff changeset
490
10315
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
491 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
492 set completeopt+=preview
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
493 setlocal completefunc=DummyCompleteFive
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
494 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
495 call assert_equal(['April'], getline(1, '$'))
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
496 pclose
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
497 q!
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
498 set completeopt&
c1cfdf43560c commit https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Christian Brabandt <cb@256bit.org>
parents: 10293
diff changeset
499 endfunc
10289
af5b6efad23f commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Christian Brabandt <cb@256bit.org>
parents: 10277
diff changeset
500
10468
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
501 " <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
502 " auto-wrap text.
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
503 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
504 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
505 let tw_save = &tw
10468
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
506 set tw=78
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
507 let li = [
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
508 \ '" zzz',
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
509 \ '" zzzyyyyyyyyyyyyyyyyyyy']
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
510 call setline(1, li)
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
511 0
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
512 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
513 call assert_equal(li, getline(1, '$'))
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
514
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
515 let &tw = tw_save
10468
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
516 q!
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
517 endfunc
251554157361 commit https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d
Christian Brabandt <cb@256bit.org>
parents: 10315
diff changeset
518
14055
ac5265f7d1c7 patch 8.1.0045: popup test isn't run completely
Christian Brabandt <cb@256bit.org>
parents: 14041
diff changeset
519 func DummyCompleteSix()
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
520 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
521 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
522 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
523
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
524 " 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
525 " 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
526 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
527 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
528 %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
529 " 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
530 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
531 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
532 %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
533 " 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
534 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
535 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
536 %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
537 " 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
538 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
539 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
540 %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
541 " 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
542 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
543 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
544
319bafc99ee8 patch 8.0.0247: need to type Ctrl-N twice to select a completion
Christian Brabandt <cb@256bit.org>
parents: 10468
diff changeset
545 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
546 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
547
10859
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
548 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
549 new
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
550 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
551
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
552 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
553 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
554 1
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
555 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
556 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
557
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
558 %d
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
559 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
560 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
561 1
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
562 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
563 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
564
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
565 bw!
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
566 endfunc
64ccb8029e06 patch 8.0.0319: insert mode completion does not respect 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 10714
diff changeset
567
10904
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
568 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
569 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
570 return ''
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
571 endfunc
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
572
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
573 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
574 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
575 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
576
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
577 new
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
578 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
579 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
580 undo
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
581 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
582
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
583 bwipe!
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
584 set completeopt&
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
585 iunmap <Right>
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
586 endfunc
c68775848f5f patch 8.0.0341: undo does not work properly when using completion
Christian Brabandt <cb@256bit.org>
parents: 10859
diff changeset
587
10916
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
588 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
589 new
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
590 setl formatoptions=tcqro
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
591 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
592 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
593 %d
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
594 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
595 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
596 %d
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
597 try
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
598 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
599 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
600 catch
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
601 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
602 endtry
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
603 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
604 bwipe!
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
605 endfunc
503b28f0a974 patch 8.0.0347: when using completion comment leader wont work
Christian Brabandt <cb@256bit.org>
parents: 10904
diff changeset
606
14055
ac5265f7d1c7 patch 8.1.0045: popup test isn't run completely
Christian Brabandt <cb@256bit.org>
parents: 14041
diff changeset
607 func MessCompleteMonths()
11424
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
608 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
609 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
610 if complete_check()
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
611 break
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
612 endif
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
613 endfor
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
614 return []
14055
ac5265f7d1c7 patch 8.1.0045: popup test isn't run completely
Christian Brabandt <cb@256bit.org>
parents: 14041
diff changeset
615 endfunc
11424
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
616
14055
ac5265f7d1c7 patch 8.1.0045: popup test isn't run completely
Christian Brabandt <cb@256bit.org>
parents: 14041
diff changeset
617 func MessCompleteMore()
11424
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
618 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
619 return []
14055
ac5265f7d1c7 patch 8.1.0045: popup test isn't run completely
Christian Brabandt <cb@256bit.org>
parents: 14041
diff changeset
620 endfunc
11424
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
621
14055
ac5265f7d1c7 patch 8.1.0045: popup test isn't run completely
Christian Brabandt <cb@256bit.org>
parents: 14041
diff changeset
622 func MessComplete(findstart, base)
11424
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
623 if a:findstart
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
624 let line = getline('.')
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
625 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
626 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
627 let start -= 1
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
628 endwhile
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
629 return start
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
630 else
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
631 call MessCompleteMonths()
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
632 call MessCompleteMore()
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
633 return []
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
634 endif
14055
ac5265f7d1c7 patch 8.1.0045: popup test isn't run completely
Christian Brabandt <cb@256bit.org>
parents: 14041
diff changeset
635 endfunc
11424
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
636
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
637 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
638 " 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
639 " should not crash.
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
640 set completefunc=MessComplete
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
641 new
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
642 call setline(1, 'Ju')
23770
385d33dfb7df patch 8.2.2426: allowing 'completefunc' to switch windows causes trouble
Bram Moolenaar <Bram@vim.org>
parents: 23328
diff changeset
643 call assert_fails('call feedkeys("A\<c-x>\<c-u>/\<esc>", "tx")', 'E578:')
385d33dfb7df patch 8.2.2426: allowing 'completefunc' to switch windows causes trouble
Bram Moolenaar <Bram@vim.org>
parents: 23328
diff changeset
644 call assert_equal('Jan/', getline(1))
11424
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
645 bwipe!
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
646 set completefunc=
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
647 endfunc
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
648
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
649 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
650 new
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
651 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
652 \ '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
653 \ '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
654 \ '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
655 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
656 \ '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
657 \ '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
658 \ '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
659 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
660 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
661 bwipe!
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
662 endfunc
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
663
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
664 func Test_popup_and_window_resize()
17657
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
665 CheckFeature terminal
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18667
diff changeset
666 CheckFeature quickfix
17657
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
667 CheckNotGui
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
668
12566
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
669 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
670 if h < 15
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
671 return
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
672 endif
12736
4ca72d1ed7f0 patch 8.0.1246: popup test has an arbitrary delay
Christian Brabandt <cb@256bit.org>
parents: 12726
diff changeset
673 let rows = h / 3
12765
c1347c968d31 patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents: 12736
diff changeset
674 let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], {'term_rows': rows})
c1347c968d31 patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents: 12736
diff changeset
675 call term_sendkeys(buf, (h / 3 - 1) . "o\<esc>")
12736
4ca72d1ed7f0 patch 8.0.1246: popup test has an arbitrary delay
Christian Brabandt <cb@256bit.org>
parents: 12726
diff changeset
676 " Wait for the nested Vim to exit insert mode, where it will show the ruler.
4ca72d1ed7f0 patch 8.0.1246: popup test has an arbitrary delay
Christian Brabandt <cb@256bit.org>
parents: 12726
diff changeset
677 " Need to trigger a redraw.
12765
c1347c968d31 patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents: 12736
diff changeset
678 call WaitFor({-> execute("redraw") == "" && term_getline(buf, rows) =~ '\<' . rows . ',.*Bot'})
12736
4ca72d1ed7f0 patch 8.0.1246: popup test has an arbitrary delay
Christian Brabandt <cb@256bit.org>
parents: 12726
diff changeset
679
12765
c1347c968d31 patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents: 12736
diff changeset
680 call term_sendkeys(buf, "Gi\<c-x>")
c1347c968d31 patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents: 12736
diff changeset
681 call term_sendkeys(buf, "\<c-v>")
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 19811
diff changeset
682 call TermWait(buf, 50)
12574
575d530df053 patch 8.0.1165: popup test is still flaky
Christian Brabandt <cb@256bit.org>
parents: 12570
diff changeset
683 " popup first entry "!" must be at the top
13808
16a062cf08c2 patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents: 13722
diff changeset
684 call WaitForAssert({-> assert_match('^!\s*$', term_getline(buf, 1))})
12566
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
685 exe 'resize +' . (h - 1)
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 19811
diff changeset
686 call TermWait(buf, 50)
12566
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
687 redraw!
12574
575d530df053 patch 8.0.1165: popup test is still flaky
Christian Brabandt <cb@256bit.org>
parents: 12570
diff changeset
688 " popup shifted down, first line is now empty
13808
16a062cf08c2 patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents: 13722
diff changeset
689 call WaitForAssert({-> assert_equal('', term_getline(buf, 1))})
12566
33a900199c25 patch 8.0.1161: popup menu drawing problem when resizing terminal
Christian Brabandt <cb@256bit.org>
parents: 11573
diff changeset
690 sleep 100m
12574
575d530df053 patch 8.0.1165: popup test is still flaky
Christian Brabandt <cb@256bit.org>
parents: 12570
diff changeset
691 " popup is below cursor line and shows first match "!"
13808
16a062cf08c2 patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents: 13722
diff changeset
692 call WaitForAssert({-> assert_match('^!\s*$', term_getline(buf, term_getcursor(buf)[0] + 1))})
12574
575d530df053 patch 8.0.1165: popup test is still flaky
Christian Brabandt <cb@256bit.org>
parents: 12570
diff changeset
693 " cursor line also shows !
12765
c1347c968d31 patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents: 12736
diff changeset
694 call assert_match('^!\s*$', term_getline(buf, term_getcursor(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
695 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
696 endfunc
11424
328a9ee98fb2 patch 8.0.0596: crash when complete() called after complete_add()
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
697
12690
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
698 func Test_popup_and_preview_autocommand()
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18667
diff changeset
699 CheckFeature python
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18667
diff changeset
700 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18667
diff changeset
701 if winheight(0) < 15
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18667
diff changeset
702 throw 'Skipped: window height insufficient'
12690
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
703 endif
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18667
diff changeset
704
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18667
diff changeset
705 " This used to crash Vim
12690
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
706 new
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
707 augroup MyBufAdd
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
708 au!
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
709 au BufAdd * nested tab sball
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
710 augroup END
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
711 set omnifunc=pythoncomplete#Complete
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
712 call setline(1, 'import os')
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
713 " make the line long
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
714 call setline(2, ' os.')
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
715 $
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
716 call feedkeys("A\<C-X>\<C-O>\<C-N>\<C-N>\<C-N>\<enter>\<esc>", 'tx')
12696
6daad7ef16be patch 8.0.1226: edit and popup tests failing
Christian Brabandt <cb@256bit.org>
parents: 12690
diff changeset
717 call assert_equal("import os", getline(1))
6daad7ef16be patch 8.0.1226: edit and popup tests failing
Christian Brabandt <cb@256bit.org>
parents: 12690
diff changeset
718 call assert_match(' os.\(EX_IOERR\|O_CREAT\)$', getline(2))
12690
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
719 call assert_equal(1, winnr('$'))
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
720 " previewwindow option is not set
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
721 call assert_equal(0, &previewwindow)
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
722 norm! gt
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
723 call assert_equal(0, &previewwindow)
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
724 norm! gT
13215
ae5f855a64be patch 8.0.1482: using feedkeys() does not work to test completion
Christian Brabandt <cb@256bit.org>
parents: 12940
diff changeset
725 call assert_equal(10, tabpagenr('$'))
12690
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
726 tabonly
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
727 pclose
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
728 augroup MyBufAdd
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
729 au!
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
730 augroup END
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
731 augroup! MyBufAdd
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
732 bw!
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
733 endfunc
fad36581f788 patch 8.0.1223: crash when using autocomplete and tab pages
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
734
15087
6a74cde86252 patch 8.1.0554: popup menu overlaps with preview window
Bram Moolenaar <Bram@vim.org>
parents: 14055
diff changeset
735 func Test_popup_and_previewwindow_dump()
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18667
diff changeset
736 CheckScreendump
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18667
diff changeset
737 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18667
diff changeset
738
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
739 let lines =<< trim END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
740 set previewheight=9
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
741 silent! pedit
19811
d1d840cfd135 patch 8.2.0462: previewwindow test fails on some systems
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
742 call setline(1, map(repeat(["ab"], 10), "v:val .. v:key"))
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
743 exec "norm! G\<C-E>\<C-E>"
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
744 END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
745 call writefile(lines, 'Xscript')
15087
6a74cde86252 patch 8.1.0554: popup menu overlaps with preview window
Bram Moolenaar <Bram@vim.org>
parents: 14055
diff changeset
746 let buf = RunVimInTerminal('-S Xscript', {})
6a74cde86252 patch 8.1.0554: popup menu overlaps with preview window
Bram Moolenaar <Bram@vim.org>
parents: 14055
diff changeset
747
19811
d1d840cfd135 patch 8.2.0462: previewwindow test fails on some systems
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
748 " wait for the script to finish
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 19811
diff changeset
749 call TermWait(buf)
19811
d1d840cfd135 patch 8.2.0462: previewwindow test fails on some systems
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
750
15087
6a74cde86252 patch 8.1.0554: popup menu overlaps with preview window
Bram Moolenaar <Bram@vim.org>
parents: 14055
diff changeset
751 " Test that popup and previewwindow do not overlap.
19811
d1d840cfd135 patch 8.2.0462: previewwindow test fails on some systems
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
752 call term_sendkeys(buf, "o")
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 19811
diff changeset
753 call TermWait(buf, 50)
19811
d1d840cfd135 patch 8.2.0462: previewwindow test fails on some systems
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
754 call term_sendkeys(buf, "\<C-X>\<C-N>")
15087
6a74cde86252 patch 8.1.0554: popup menu overlaps with preview window
Bram Moolenaar <Bram@vim.org>
parents: 14055
diff changeset
755 call VerifyScreenDump(buf, 'Test_popup_and_previewwindow_01', {})
6a74cde86252 patch 8.1.0554: popup menu overlaps with preview window
Bram Moolenaar <Bram@vim.org>
parents: 14055
diff changeset
756
6a74cde86252 patch 8.1.0554: popup menu overlaps with preview window
Bram Moolenaar <Bram@vim.org>
parents: 14055
diff changeset
757 call term_sendkeys(buf, "\<Esc>u")
6a74cde86252 patch 8.1.0554: popup menu overlaps with preview window
Bram Moolenaar <Bram@vim.org>
parents: 14055
diff changeset
758 call StopVimInTerminal(buf)
6a74cde86252 patch 8.1.0554: popup menu overlaps with preview window
Bram Moolenaar <Bram@vim.org>
parents: 14055
diff changeset
759 call delete('Xscript')
6a74cde86252 patch 8.1.0554: popup menu overlaps with preview window
Bram Moolenaar <Bram@vim.org>
parents: 14055
diff changeset
760 endfunc
6a74cde86252 patch 8.1.0554: popup menu overlaps with preview window
Bram Moolenaar <Bram@vim.org>
parents: 14055
diff changeset
761
12883
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12765
diff changeset
762 func Test_balloon_split()
17783
45eca7143d7c patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17756
diff changeset
763 CheckFunction balloon_split
45eca7143d7c patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17756
diff changeset
764
12883
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12765
diff changeset
765 call assert_equal([
12940
5045d3076db0 patch 8.0.1346: crash when passing 50 char string to balloon_split()
Christian Brabandt <cb@256bit.org>
parents: 12887
diff changeset
766 \ 'tempname: 0x555555e380a0 "/home/mool/.viminfz.tmp"',
5045d3076db0 patch 8.0.1346: crash when passing 50 char string to balloon_split()
Christian Brabandt <cb@256bit.org>
parents: 12887
diff changeset
767 \ ], balloon_split(
5045d3076db0 patch 8.0.1346: crash when passing 50 char string to balloon_split()
Christian Brabandt <cb@256bit.org>
parents: 12887
diff changeset
768 \ 'tempname: 0x555555e380a0 "/home/mool/.viminfz.tmp"'))
5045d3076db0 patch 8.0.1346: crash when passing 50 char string to balloon_split()
Christian Brabandt <cb@256bit.org>
parents: 12887
diff changeset
769 call assert_equal([
12883
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12765
diff changeset
770 \ 'one two three four one two three four one two thre',
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12765
diff changeset
771 \ 'e four',
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12765
diff changeset
772 \ ], balloon_split(
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12765
diff changeset
773 \ 'one two three four one two three four one two three four'))
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12765
diff changeset
774
17783
45eca7143d7c patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17756
diff changeset
775 eval 'struct = {one = 1, two = 2, three = 3}'
45eca7143d7c patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17756
diff changeset
776 \ ->balloon_split()
45eca7143d7c patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17756
diff changeset
777 \ ->assert_equal([
45eca7143d7c patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17756
diff changeset
778 \ 'struct = {',
45eca7143d7c patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17756
diff changeset
779 \ ' one = 1,',
45eca7143d7c patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17756
diff changeset
780 \ ' two = 2,',
45eca7143d7c patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17756
diff changeset
781 \ ' three = 3}',
45eca7143d7c patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17756
diff changeset
782 \ ])
12883
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12765
diff changeset
783
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12765
diff changeset
784 call assert_equal([
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12765
diff changeset
785 \ 'struct = {',
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12765
diff changeset
786 \ ' one = 1,',
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12765
diff changeset
787 \ ' nested = {',
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12765
diff changeset
788 \ ' n1 = "yes",',
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12765
diff changeset
789 \ ' n2 = "no"}',
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12765
diff changeset
790 \ ' two = 2}',
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12765
diff changeset
791 \ ], balloon_split(
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12765
diff changeset
792 \ 'struct = {one = 1, nested = {n1 = "yes", n2 = "no"} two = 2}'))
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12765
diff changeset
793 call assert_equal([
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12765
diff changeset
794 \ 'struct = 0x234 {',
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12765
diff changeset
795 \ ' long = 2343 "\\"some long string that will be wr',
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12765
diff changeset
796 \ 'apped in two\\"",',
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12765
diff changeset
797 \ ' next = 123}',
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12765
diff changeset
798 \ ], balloon_split(
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12765
diff changeset
799 \ 'struct = 0x234 {long = 2343 "\\"some long string that will be wrapped in two\\"", next = 123}'))
18667
de350001150c patch 8.1.2325: crash when using balloon with empty line
Bram Moolenaar <Bram@vim.org>
parents: 17837
diff changeset
800 call assert_equal([
de350001150c patch 8.1.2325: crash when using balloon with empty line
Bram Moolenaar <Bram@vim.org>
parents: 17837
diff changeset
801 \ 'Some comment',
de350001150c patch 8.1.2325: crash when using balloon with empty line
Bram Moolenaar <Bram@vim.org>
parents: 17837
diff changeset
802 \ '',
de350001150c patch 8.1.2325: crash when using balloon with empty line
Bram Moolenaar <Bram@vim.org>
parents: 17837
diff changeset
803 \ 'typedef this that;',
de350001150c patch 8.1.2325: crash when using balloon with empty line
Bram Moolenaar <Bram@vim.org>
parents: 17837
diff changeset
804 \ ], balloon_split(
de350001150c patch 8.1.2325: crash when using balloon with empty line
Bram Moolenaar <Bram@vim.org>
parents: 17837
diff changeset
805 \ "Some comment\n\ntypedef this that;"))
12883
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12765
diff changeset
806 endfunc
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12765
diff changeset
807
13329
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
808 func Test_popup_position()
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18667
diff changeset
809 CheckScreendump
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18667
diff changeset
810
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
811 let lines =<< trim END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
812 123456789_123456789_123456789_a
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
813 123456789_123456789_123456789_b
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
814 123
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
815 END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
816 call writefile(lines, 'Xtest')
13329
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
817 let buf = RunVimInTerminal('Xtest', {})
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
818 call term_sendkeys(buf, ":vsplit\<CR>")
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
819
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
820 " default pumwidth in left window: overlap in right window
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
821 call term_sendkeys(buf, "GA\<C-N>")
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
822 call VerifyScreenDump(buf, 'Test_popup_position_01', {'rows': 8})
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
823 call term_sendkeys(buf, "\<Esc>u")
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
824
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
825 " default pumwidth: fill until right of window
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
826 call term_sendkeys(buf, "\<C-W>l")
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
827 call term_sendkeys(buf, "GA\<C-N>")
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
828 call VerifyScreenDump(buf, 'Test_popup_position_02', {'rows': 8})
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
829
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
830 " larger pumwidth: used as minimum width
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
831 call term_sendkeys(buf, "\<Esc>u")
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
832 call term_sendkeys(buf, ":set pumwidth=30\<CR>")
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
833 call term_sendkeys(buf, "GA\<C-N>")
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
834 call VerifyScreenDump(buf, 'Test_popup_position_03', {'rows': 8})
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
835
13331
1ba4f926247c patch 8.0.1540: popup menu positioning fails with longer string
Christian Brabandt <cb@256bit.org>
parents: 13329
diff changeset
836 " completed text wider than the window and 'pumwidth' smaller than available
1ba4f926247c patch 8.0.1540: popup menu positioning fails with longer string
Christian Brabandt <cb@256bit.org>
parents: 13329
diff changeset
837 " space
1ba4f926247c patch 8.0.1540: popup menu positioning fails with longer string
Christian Brabandt <cb@256bit.org>
parents: 13329
diff changeset
838 call term_sendkeys(buf, "\<Esc>u")
1ba4f926247c patch 8.0.1540: popup menu positioning fails with longer string
Christian Brabandt <cb@256bit.org>
parents: 13329
diff changeset
839 call term_sendkeys(buf, ":set pumwidth=20\<CR>")
1ba4f926247c patch 8.0.1540: popup menu positioning fails with longer string
Christian Brabandt <cb@256bit.org>
parents: 13329
diff changeset
840 call term_sendkeys(buf, "ggI123456789_\<Esc>")
1ba4f926247c patch 8.0.1540: popup menu positioning fails with longer string
Christian Brabandt <cb@256bit.org>
parents: 13329
diff changeset
841 call term_sendkeys(buf, "jI123456789_\<Esc>")
1ba4f926247c patch 8.0.1540: popup menu positioning fails with longer string
Christian Brabandt <cb@256bit.org>
parents: 13329
diff changeset
842 call term_sendkeys(buf, "GA\<C-N>")
1ba4f926247c patch 8.0.1540: popup menu positioning fails with longer string
Christian Brabandt <cb@256bit.org>
parents: 13329
diff changeset
843 call VerifyScreenDump(buf, 'Test_popup_position_04', {'rows': 10})
1ba4f926247c patch 8.0.1540: popup menu positioning fails with longer string
Christian Brabandt <cb@256bit.org>
parents: 13329
diff changeset
844
13329
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
845 call term_sendkeys(buf, "\<Esc>u")
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
846 call StopVimInTerminal(buf)
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
847 call delete('Xtest')
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
848 endfunc
424321d6eea7 patch 8.0.1539: no test for the popup menu positioning
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
849
13408
de69701e0592 patch 8.0.1578: no test for :popup in terminal
Christian Brabandt <cb@256bit.org>
parents: 13331
diff changeset
850 func Test_popup_command()
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18667
diff changeset
851 CheckScreendump
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18667
diff changeset
852 CheckFeature menu
13408
de69701e0592 patch 8.0.1578: no test for :popup in terminal
Christian Brabandt <cb@256bit.org>
parents: 13331
diff changeset
853
19657
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
854 menu Test.Foo Foo
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
855 call assert_fails('popup Test.Foo', 'E336:')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
856 call assert_fails('popup Test.Foo.X', 'E327:')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
857 call assert_fails('popup Foo', 'E337:')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
858 unmenu Test.Foo
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
859
23328
8e0ec52cad85 patch 8.2.2207: illegal memory access if popup menu items are changed
Bram Moolenaar <Bram@vim.org>
parents: 22742
diff changeset
860 let script =<< trim END
8e0ec52cad85 patch 8.2.2207: illegal memory access if popup menu items are changed
Bram Moolenaar <Bram@vim.org>
parents: 22742
diff changeset
861 func StartTimer()
8e0ec52cad85 patch 8.2.2207: illegal memory access if popup menu items are changed
Bram Moolenaar <Bram@vim.org>
parents: 22742
diff changeset
862 call timer_start(100, {-> ChangeMenu()})
8e0ec52cad85 patch 8.2.2207: illegal memory access if popup menu items are changed
Bram Moolenaar <Bram@vim.org>
parents: 22742
diff changeset
863 endfunc
8e0ec52cad85 patch 8.2.2207: illegal memory access if popup menu items are changed
Bram Moolenaar <Bram@vim.org>
parents: 22742
diff changeset
864 func ChangeMenu()
8e0ec52cad85 patch 8.2.2207: illegal memory access if popup menu items are changed
Bram Moolenaar <Bram@vim.org>
parents: 22742
diff changeset
865 nunmenu PopUp.&Paste
8e0ec52cad85 patch 8.2.2207: illegal memory access if popup menu items are changed
Bram Moolenaar <Bram@vim.org>
parents: 22742
diff changeset
866 nnoremenu 1.40 PopUp.&Paste :echomsg "pasted"<CR>
8e0ec52cad85 patch 8.2.2207: illegal memory access if popup menu items are changed
Bram Moolenaar <Bram@vim.org>
parents: 22742
diff changeset
867 echomsg 'changed'
8e0ec52cad85 patch 8.2.2207: illegal memory access if popup menu items are changed
Bram Moolenaar <Bram@vim.org>
parents: 22742
diff changeset
868 endfunc
8e0ec52cad85 patch 8.2.2207: illegal memory access if popup menu items are changed
Bram Moolenaar <Bram@vim.org>
parents: 22742
diff changeset
869 END
8e0ec52cad85 patch 8.2.2207: illegal memory access if popup menu items are changed
Bram Moolenaar <Bram@vim.org>
parents: 22742
diff changeset
870 call writefile(script, 'XtimerScript')
8e0ec52cad85 patch 8.2.2207: illegal memory access if popup menu items are changed
Bram Moolenaar <Bram@vim.org>
parents: 22742
diff changeset
871
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
872 let lines =<< trim END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
873 one two three four five
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
874 and one two Xthree four five
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
875 one more two three four five
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
876 END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
877 call writefile(lines, 'Xtest')
23328
8e0ec52cad85 patch 8.2.2207: illegal memory access if popup menu items are changed
Bram Moolenaar <Bram@vim.org>
parents: 22742
diff changeset
878 let buf = RunVimInTerminal('-S XtimerScript Xtest', {})
13408
de69701e0592 patch 8.0.1578: no test for :popup in terminal
Christian Brabandt <cb@256bit.org>
parents: 13331
diff changeset
879 call term_sendkeys(buf, ":source $VIMRUNTIME/menu.vim\<CR>")
de69701e0592 patch 8.0.1578: no test for :popup in terminal
Christian Brabandt <cb@256bit.org>
parents: 13331
diff changeset
880 call term_sendkeys(buf, "/X\<CR>:popup PopUp\<CR>")
de69701e0592 patch 8.0.1578: no test for :popup in terminal
Christian Brabandt <cb@256bit.org>
parents: 13331
diff changeset
881 call VerifyScreenDump(buf, 'Test_popup_command_01', {})
de69701e0592 patch 8.0.1578: no test for :popup in terminal
Christian Brabandt <cb@256bit.org>
parents: 13331
diff changeset
882
23328
8e0ec52cad85 patch 8.2.2207: illegal memory access if popup menu items are changed
Bram Moolenaar <Bram@vim.org>
parents: 22742
diff changeset
883 " go to the Paste entry in the menu
13408
de69701e0592 patch 8.0.1578: no test for :popup in terminal
Christian Brabandt <cb@256bit.org>
parents: 13331
diff changeset
884 call term_sendkeys(buf, "jj")
de69701e0592 patch 8.0.1578: no test for :popup in terminal
Christian Brabandt <cb@256bit.org>
parents: 13331
diff changeset
885 call VerifyScreenDump(buf, 'Test_popup_command_02', {})
de69701e0592 patch 8.0.1578: no test for :popup in terminal
Christian Brabandt <cb@256bit.org>
parents: 13331
diff changeset
886
de69701e0592 patch 8.0.1578: no test for :popup in terminal
Christian Brabandt <cb@256bit.org>
parents: 13331
diff changeset
887 " Select a word
de69701e0592 patch 8.0.1578: no test for :popup in terminal
Christian Brabandt <cb@256bit.org>
parents: 13331
diff changeset
888 call term_sendkeys(buf, "j\<CR>")
de69701e0592 patch 8.0.1578: no test for :popup in terminal
Christian Brabandt <cb@256bit.org>
parents: 13331
diff changeset
889 call VerifyScreenDump(buf, 'Test_popup_command_03', {})
de69701e0592 patch 8.0.1578: no test for :popup in terminal
Christian Brabandt <cb@256bit.org>
parents: 13331
diff changeset
890
de69701e0592 patch 8.0.1578: no test for :popup in terminal
Christian Brabandt <cb@256bit.org>
parents: 13331
diff changeset
891 call term_sendkeys(buf, "\<Esc>")
23328
8e0ec52cad85 patch 8.2.2207: illegal memory access if popup menu items are changed
Bram Moolenaar <Bram@vim.org>
parents: 22742
diff changeset
892
8e0ec52cad85 patch 8.2.2207: illegal memory access if popup menu items are changed
Bram Moolenaar <Bram@vim.org>
parents: 22742
diff changeset
893 " Set a timer to change a menu entry while it's displayed. The text should
8e0ec52cad85 patch 8.2.2207: illegal memory access if popup menu items are changed
Bram Moolenaar <Bram@vim.org>
parents: 22742
diff changeset
894 " not change but the command does. Making the screendump also verifies that
8e0ec52cad85 patch 8.2.2207: illegal memory access if popup menu items are changed
Bram Moolenaar <Bram@vim.org>
parents: 22742
diff changeset
895 " "changed" shows up, which means the timer triggered
8e0ec52cad85 patch 8.2.2207: illegal memory access if popup menu items are changed
Bram Moolenaar <Bram@vim.org>
parents: 22742
diff changeset
896 call term_sendkeys(buf, "/X\<CR>:call StartTimer() | popup PopUp\<CR>")
8e0ec52cad85 patch 8.2.2207: illegal memory access if popup menu items are changed
Bram Moolenaar <Bram@vim.org>
parents: 22742
diff changeset
897 call VerifyScreenDump(buf, 'Test_popup_command_04', {})
8e0ec52cad85 patch 8.2.2207: illegal memory access if popup menu items are changed
Bram Moolenaar <Bram@vim.org>
parents: 22742
diff changeset
898
8e0ec52cad85 patch 8.2.2207: illegal memory access if popup menu items are changed
Bram Moolenaar <Bram@vim.org>
parents: 22742
diff changeset
899 " Select the Paste entry, executes the changed menu item.
8e0ec52cad85 patch 8.2.2207: illegal memory access if popup menu items are changed
Bram Moolenaar <Bram@vim.org>
parents: 22742
diff changeset
900 call term_sendkeys(buf, "jj\<CR>")
8e0ec52cad85 patch 8.2.2207: illegal memory access if popup menu items are changed
Bram Moolenaar <Bram@vim.org>
parents: 22742
diff changeset
901 call VerifyScreenDump(buf, 'Test_popup_command_05', {})
8e0ec52cad85 patch 8.2.2207: illegal memory access if popup menu items are changed
Bram Moolenaar <Bram@vim.org>
parents: 22742
diff changeset
902
13408
de69701e0592 patch 8.0.1578: no test for :popup in terminal
Christian Brabandt <cb@256bit.org>
parents: 13331
diff changeset
903 call StopVimInTerminal(buf)
de69701e0592 patch 8.0.1578: no test for :popup in terminal
Christian Brabandt <cb@256bit.org>
parents: 13331
diff changeset
904 call delete('Xtest')
23328
8e0ec52cad85 patch 8.2.2207: illegal memory access if popup menu items are changed
Bram Moolenaar <Bram@vim.org>
parents: 22742
diff changeset
905 call delete('XtimerScript')
13408
de69701e0592 patch 8.0.1578: no test for :popup in terminal
Christian Brabandt <cb@256bit.org>
parents: 13331
diff changeset
906 endfunc
de69701e0592 patch 8.0.1578: no test for :popup in terminal
Christian Brabandt <cb@256bit.org>
parents: 13331
diff changeset
907
13718
66b1d74be322 patch 8.0.1731: characters deleted on completion
Christian Brabandt <cb@256bit.org>
parents: 13408
diff changeset
908 func Test_popup_complete_backwards()
66b1d74be322 patch 8.0.1731: characters deleted on completion
Christian Brabandt <cb@256bit.org>
parents: 13408
diff changeset
909 new
66b1d74be322 patch 8.0.1731: characters deleted on completion
Christian Brabandt <cb@256bit.org>
parents: 13408
diff changeset
910 call setline(1, ['Post', 'Port', 'Po'])
66b1d74be322 patch 8.0.1731: characters deleted on completion
Christian Brabandt <cb@256bit.org>
parents: 13408
diff changeset
911 let expected=['Post', 'Port', 'Port']
66b1d74be322 patch 8.0.1731: characters deleted on completion
Christian Brabandt <cb@256bit.org>
parents: 13408
diff changeset
912 call cursor(3,2)
66b1d74be322 patch 8.0.1731: characters deleted on completion
Christian Brabandt <cb@256bit.org>
parents: 13408
diff changeset
913 call feedkeys("A\<C-X>". repeat("\<C-P>", 3). "rt\<cr>", 'tx')
66b1d74be322 patch 8.0.1731: characters deleted on completion
Christian Brabandt <cb@256bit.org>
parents: 13408
diff changeset
914 call assert_equal(expected, getline(1,'$'))
66b1d74be322 patch 8.0.1731: characters deleted on completion
Christian Brabandt <cb@256bit.org>
parents: 13408
diff changeset
915 bwipe!
66b1d74be322 patch 8.0.1731: characters deleted on completion
Christian Brabandt <cb@256bit.org>
parents: 13408
diff changeset
916 endfunc
13408
de69701e0592 patch 8.0.1578: no test for :popup in terminal
Christian Brabandt <cb@256bit.org>
parents: 13331
diff changeset
917
13722
a86677cf8446 patch 8.0.1733: incomplete testing for completion fix
Christian Brabandt <cb@256bit.org>
parents: 13718
diff changeset
918 func Test_popup_complete_backwards_ctrl_p()
a86677cf8446 patch 8.0.1733: incomplete testing for completion fix
Christian Brabandt <cb@256bit.org>
parents: 13718
diff changeset
919 new
a86677cf8446 patch 8.0.1733: incomplete testing for completion fix
Christian Brabandt <cb@256bit.org>
parents: 13718
diff changeset
920 call setline(1, ['Post', 'Port', 'Po'])
a86677cf8446 patch 8.0.1733: incomplete testing for completion fix
Christian Brabandt <cb@256bit.org>
parents: 13718
diff changeset
921 let expected=['Post', 'Port', 'Port']
a86677cf8446 patch 8.0.1733: incomplete testing for completion fix
Christian Brabandt <cb@256bit.org>
parents: 13718
diff changeset
922 call cursor(3,2)
a86677cf8446 patch 8.0.1733: incomplete testing for completion fix
Christian Brabandt <cb@256bit.org>
parents: 13718
diff changeset
923 call feedkeys("A\<C-P>\<C-N>rt\<cr>", 'tx')
a86677cf8446 patch 8.0.1733: incomplete testing for completion fix
Christian Brabandt <cb@256bit.org>
parents: 13718
diff changeset
924 call assert_equal(expected, getline(1,'$'))
a86677cf8446 patch 8.0.1733: incomplete testing for completion fix
Christian Brabandt <cb@256bit.org>
parents: 13718
diff changeset
925 bwipe!
a86677cf8446 patch 8.0.1733: incomplete testing for completion fix
Christian Brabandt <cb@256bit.org>
parents: 13718
diff changeset
926 endfunc
a86677cf8446 patch 8.0.1733: incomplete testing for completion fix
Christian Brabandt <cb@256bit.org>
parents: 13718
diff changeset
927
14055
ac5265f7d1c7 patch 8.1.0045: popup test isn't run completely
Christian Brabandt <cb@256bit.org>
parents: 14041
diff changeset
928 func Test_complete_o_tab()
13870
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
929 let s:o_char_pressed = 0
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
930
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
931 fun! s:act_on_text_changed()
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
932 if s:o_char_pressed
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
933 let s:o_char_pressed = 0
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
934 call feedkeys("\<c-x>\<c-n>", 'i')
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
935 endif
14055
ac5265f7d1c7 patch 8.1.0045: popup test isn't run completely
Christian Brabandt <cb@256bit.org>
parents: 14041
diff changeset
936 endfunc
13870
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
937
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
938 set completeopt=menu,noselect
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
939 new
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
940 imap <expr> <buffer> <tab> pumvisible() ? "\<c-p>" : "X"
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
941 autocmd! InsertCharPre <buffer> let s:o_char_pressed = (v:char ==# 'o')
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
942 autocmd! TextChangedI <buffer> call <sid>act_on_text_changed()
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
943 call setline(1, ['hoard', 'hoax', 'hoarse', ''])
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
944 let l:expected = ['hoard', 'hoax', 'hoarse', 'hoax', 'hoax']
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
945 call cursor(4,1)
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
946 call test_override("char_avail", 1)
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
947 call feedkeys("Ahoa\<tab>\<tab>\<c-y>\<esc>", 'tx')
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
948 call feedkeys("oho\<tab>\<tab>\<c-y>\<esc>", 'tx')
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
949 call assert_equal(l:expected, getline(1,'$'))
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
950
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
951 call test_override("char_avail", 0)
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
952 bwipe!
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
953 set completeopt&
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
954 delfunc s:act_on_text_changed
14055
ac5265f7d1c7 patch 8.1.0045: popup test isn't run completely
Christian Brabandt <cb@256bit.org>
parents: 14041
diff changeset
955 endfunc
13870
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
956
15375
6012cc6936f7 patch 8.1.0695: internal error when using :popup
Bram Moolenaar <Bram@vim.org>
parents: 15087
diff changeset
957 func Test_menu_only_exists_in_terminal()
17657
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
958 CheckCommand tlmenu
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
959 CheckNotGui
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
960
15375
6012cc6936f7 patch 8.1.0695: internal error when using :popup
Bram Moolenaar <Bram@vim.org>
parents: 15087
diff changeset
961 tlnoremenu &Edit.&Paste<Tab>"+gP <C-W>"+
6012cc6936f7 patch 8.1.0695: internal error when using :popup
Bram Moolenaar <Bram@vim.org>
parents: 15087
diff changeset
962 aunmenu *
6012cc6936f7 patch 8.1.0695: internal error when using :popup
Bram Moolenaar <Bram@vim.org>
parents: 15087
diff changeset
963 try
6012cc6936f7 patch 8.1.0695: internal error when using :popup
Bram Moolenaar <Bram@vim.org>
parents: 15087
diff changeset
964 popup Edit
6012cc6936f7 patch 8.1.0695: internal error when using :popup
Bram Moolenaar <Bram@vim.org>
parents: 15087
diff changeset
965 call assert_false(1, 'command should have failed')
6012cc6936f7 patch 8.1.0695: internal error when using :popup
Bram Moolenaar <Bram@vim.org>
parents: 15087
diff changeset
966 catch
6012cc6936f7 patch 8.1.0695: internal error when using :popup
Bram Moolenaar <Bram@vim.org>
parents: 15087
diff changeset
967 call assert_exception('E328:')
6012cc6936f7 patch 8.1.0695: internal error when using :popup
Bram Moolenaar <Bram@vim.org>
parents: 15087
diff changeset
968 endtry
6012cc6936f7 patch 8.1.0695: internal error when using :popup
Bram Moolenaar <Bram@vim.org>
parents: 15087
diff changeset
969 endfunc
13870
08370aad873d patch 8.0.1806: InsertCharPre causes problems for autocomplete
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
970
16127
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
971 func Test_popup_complete_info_01()
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
972 new
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
973 inoremap <buffer><F5> <C-R>=complete_info().mode<CR>
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
974 func s:complTestEval() abort
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
975 call complete(1, ['aa', 'ab'])
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
976 return ''
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
977 endfunc
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
978 inoremap <buffer><F6> <C-R>=s:complTestEval()<CR>
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
979 call writefile([
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
980 \ 'dummy dummy.txt 1',
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
981 \], 'Xdummy.txt')
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
982 setlocal tags=Xdummy.txt
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
983 setlocal dictionary=Xdummy.txt
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
984 setlocal thesaurus=Xdummy.txt
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
985 setlocal omnifunc=syntaxcomplete#Complete
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
986 setlocal completefunc=syntaxcomplete#Complete
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
987 setlocal spell
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
988 for [keys, mode_name] in [
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
989 \ ["", ''],
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
990 \ ["\<C-X>", 'ctrl_x'],
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
991 \ ["\<C-X>\<C-N>", 'keyword'],
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
992 \ ["\<C-X>\<C-P>", 'keyword'],
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
993 \ ["\<C-X>\<C-L>", 'whole_line'],
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
994 \ ["\<C-X>\<C-F>", 'files'],
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
995 \ ["\<C-X>\<C-]>", 'tags'],
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
996 \ ["\<C-X>\<C-D>", 'path_defines'],
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
997 \ ["\<C-X>\<C-I>", 'path_patterns'],
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
998 \ ["\<C-X>\<C-K>", 'dictionary'],
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
999 \ ["\<C-X>\<C-T>", 'thesaurus'],
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1000 \ ["\<C-X>\<C-V>", 'cmdline'],
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1001 \ ["\<C-X>\<C-U>", 'function'],
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1002 \ ["\<C-X>\<C-O>", 'omni'],
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1003 \ ["\<C-X>s", 'spell'],
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1004 \ ["\<F6>", 'eval'],
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1005 \]
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1006 call feedkeys("i" . keys . "\<F5>\<Esc>", 'tx')
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1007 call assert_equal(mode_name, getline('.'))
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1008 %d
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1009 endfor
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1010 call delete('Xdummy.txt')
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1011 bwipe!
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1012 endfunc
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1013
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1014 func UserDefinedComplete(findstart, base)
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1015 if a:findstart
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1016 return 0
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1017 else
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1018 return [
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1019 \ { 'word': 'Jan', 'menu': 'January' },
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1020 \ { 'word': 'Feb', 'menu': 'February' },
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1021 \ { 'word': 'Mar', 'menu': 'March' },
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1022 \ { 'word': 'Apr', 'menu': 'April' },
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1023 \ { 'word': 'May', 'menu': 'May' },
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1024 \ ]
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1025 endif
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1026 endfunc
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1027
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1028 func GetCompleteInfo()
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1029 if empty(g:compl_what)
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1030 let g:compl_info = complete_info()
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1031 else
17837
f71ee7b04f0b patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17783
diff changeset
1032 let g:compl_info = g:compl_what->complete_info()
16127
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1033 endif
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1034 return ''
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1035 endfunc
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1036
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1037 func Test_popup_complete_info_02()
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1038 new
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1039 inoremap <buffer><F5> <C-R>=GetCompleteInfo()<CR>
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1040 setlocal completefunc=UserDefinedComplete
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1041
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1042 let d = {
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1043 \ 'mode': 'function',
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1044 \ 'pum_visible': 1,
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1045 \ 'items': [
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1046 \ {'word': 'Jan', 'menu': 'January', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''},
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1047 \ {'word': 'Feb', 'menu': 'February', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''},
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1048 \ {'word': 'Mar', 'menu': 'March', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''},
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1049 \ {'word': 'Apr', 'menu': 'April', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''},
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1050 \ {'word': 'May', 'menu': 'May', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''}
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1051 \ ],
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1052 \ 'selected': 0,
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1053 \ }
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1054
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1055 let g:compl_what = []
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1056 call feedkeys("i\<C-X>\<C-U>\<F5>", 'tx')
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1057 call assert_equal(d, g:compl_info)
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1058
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1059 let g:compl_what = ['mode', 'pum_visible', 'selected']
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1060 call remove(d, 'items')
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1061 call feedkeys("i\<C-X>\<C-U>\<F5>", 'tx')
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1062 call assert_equal(d, g:compl_info)
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1063
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1064 let g:compl_what = ['mode']
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1065 call remove(d, 'selected')
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1066 call remove(d, 'pum_visible')
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1067 call feedkeys("i\<C-X>\<C-U>\<F5>", 'tx')
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1068 call assert_equal(d, g:compl_info)
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1069 bwipe!
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1070 endfunc
0375e54f0adc patch 8.1.1068: cannot get all the information about current completion
Bram Moolenaar <Bram@vim.org>
parents: 15375
diff changeset
1071
17756
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1072 func Test_popup_complete_info_no_pum()
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1073 new
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1074 call assert_false( pumvisible() )
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1075 let no_pum_info = complete_info()
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1076 let d = {
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1077 \ 'mode': '',
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1078 \ 'pum_visible': 0,
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1079 \ 'items': [],
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1080 \ 'selected': -1,
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1081 \ }
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1082 call assert_equal( d, complete_info() )
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1083 bwipe!
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1084 endfunc
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1085
16268
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1086 func Test_CompleteChanged()
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1087 new
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1088 call setline(1, ['foo', 'bar', 'foobar', ''])
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1089 set complete=. completeopt=noinsert,noselect,menuone
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1090 function! OnPumChange()
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1091 let g:event = copy(v:event)
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1092 let g:item = get(v:event, 'completed_item', {})
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1093 let g:word = get(g:item, 'word', v:null)
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1094 endfunction
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1095 augroup AAAAA_Group
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1096 au!
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1097 autocmd CompleteChanged * :call OnPumChange()
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1098 augroup END
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1099 call cursor(4, 1)
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1100
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1101 call feedkeys("Sf\<C-N>", 'tx')
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1102 call assert_equal({'completed_item': {}, 'width': 15,
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1103 \ 'height': 2, 'size': 2,
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1104 \ 'col': 0, 'row': 4, 'scrollbar': v:false}, g:event)
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1105 call feedkeys("a\<C-N>\<C-N>\<C-E>", 'tx')
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1106 call assert_equal('foo', g:word)
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1107 call feedkeys("a\<C-N>\<C-N>\<C-N>\<C-E>", 'tx')
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1108 call assert_equal('foobar', g:word)
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1109 call feedkeys("a\<C-N>\<C-N>\<C-N>\<C-N>\<C-E>", 'tx')
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1110 call assert_equal(v:null, g:word)
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1111 call feedkeys("a\<C-N>\<C-N>\<C-N>\<C-N>\<C-P>", 'tx')
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1112 call assert_equal('foobar', g:word)
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1113
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1114 autocmd! AAAAA_Group
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1115 set complete& completeopt&
17756
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1116 delfunc! OnPumChange
16268
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1117 bw!
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1118 endfunc
0f65f2808470 patch 8.1.1138: plugins don't get notified when the popup menu changes
Bram Moolenaar <Bram@vim.org>
parents: 16237
diff changeset
1119
17756
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1120 function! GetPumPosition()
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1121 call assert_true( pumvisible() )
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1122 let g:pum_pos = pum_getpos()
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1123 return ''
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1124 endfunction
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1125
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1126 func Test_pum_getpos()
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1127 new
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1128 inoremap <buffer><F5> <C-R>=GetPumPosition()<CR>
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1129 setlocal completefunc=UserDefinedComplete
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1130
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1131 let d = {
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1132 \ 'height': 5,
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1133 \ 'width': 15,
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1134 \ 'row': 1,
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1135 \ 'col': 0,
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1136 \ 'size': 5,
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1137 \ 'scrollbar': v:false,
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1138 \ }
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1139 call feedkeys("i\<C-X>\<C-U>\<F5>", 'tx')
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1140 call assert_equal(d, g:pum_pos)
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1141
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1142 call assert_false( pumvisible() )
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1143 call assert_equal( {}, pum_getpos() )
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1144 bw!
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1145 unlet g:pum_pos
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1146 endfunc
a7afcea6f40a patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1147
24677
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1148 " Test for the popup menu with the 'rightleft' option set
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1149 func Test_pum_rightleft()
24798
a84ed6d4aa9f patch 8.2.2937: popup test fails if rightleft feature not enabled
Bram Moolenaar <Bram@vim.org>
parents: 24677
diff changeset
1150 CheckFeature rightleft
24677
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1151 CheckScreendump
24798
a84ed6d4aa9f patch 8.2.2937: popup test fails if rightleft feature not enabled
Bram Moolenaar <Bram@vim.org>
parents: 24677
diff changeset
1152
24677
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1153 let lines =<< trim END
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1154 abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1155 vim
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1156 victory
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1157 END
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1158 call writefile(lines, 'Xtest1')
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1159 let buf = RunVimInTerminal('--cmd "set rightleft" Xtest1', {})
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1160 call term_wait(buf)
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1161 call term_sendkeys(buf, "Go\<C-P>")
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1162 call term_wait(buf)
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1163 call VerifyScreenDump(buf, 'Test_pum_rightleft_01', {'rows': 8})
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1164 call term_sendkeys(buf, "\<C-P>\<C-Y>")
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1165 call term_wait(buf)
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1166 redraw!
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1167 call assert_match('\s*miv', Screenline(5))
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1168
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1169 " Test for expanding tabs to spaces in the popup menu
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1170 let lines =<< trim END
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1171 one two
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1172 one three
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1173 four
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1174 END
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1175 call writefile(lines, 'Xtest2')
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1176 call term_sendkeys(buf, "\<Esc>:e! Xtest2\<CR>")
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1177 call term_wait(buf)
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1178 call term_sendkeys(buf, "Goone\<C-X>\<C-L>")
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1179 call term_wait(buf)
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1180 redraw!
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1181 call VerifyScreenDump(buf, 'Test_pum_rightleft_02', {'rows': 7})
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1182 call term_sendkeys(buf, "\<C-Y>")
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1183 call term_wait(buf)
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1184 redraw!
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1185 call assert_match('\s*eerht eno', Screenline(4))
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1186
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1187 call StopVimInTerminal(buf)
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1188 call delete('Xtest1')
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1189 call delete('Xtest2')
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1190 endfunc
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1191
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1192 " Test for a popup menu with a scrollbar
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1193 func Test_pum_scrollbar()
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1194 CheckScreendump
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1195 let lines =<< trim END
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1196 one
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1197 two
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1198 three
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1199 END
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1200 call writefile(lines, 'Xtest1')
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1201 let buf = RunVimInTerminal('--cmd "set pumheight=2" Xtest1', {})
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1202 call term_wait(buf)
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1203 call term_sendkeys(buf, "Go\<C-P>\<C-P>\<C-P>")
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1204 call term_wait(buf)
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1205 call VerifyScreenDump(buf, 'Test_pum_scrollbar_01', {'rows': 7})
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1206 call term_sendkeys(buf, "\<C-E>\<Esc>dd")
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1207 call term_wait(buf)
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1208
24798
a84ed6d4aa9f patch 8.2.2937: popup test fails if rightleft feature not enabled
Bram Moolenaar <Bram@vim.org>
parents: 24677
diff changeset
1209 if has('rightleft')
a84ed6d4aa9f patch 8.2.2937: popup test fails if rightleft feature not enabled
Bram Moolenaar <Bram@vim.org>
parents: 24677
diff changeset
1210 call term_sendkeys(buf, ":set rightleft\<CR>")
a84ed6d4aa9f patch 8.2.2937: popup test fails if rightleft feature not enabled
Bram Moolenaar <Bram@vim.org>
parents: 24677
diff changeset
1211 call term_wait(buf)
a84ed6d4aa9f patch 8.2.2937: popup test fails if rightleft feature not enabled
Bram Moolenaar <Bram@vim.org>
parents: 24677
diff changeset
1212 call term_sendkeys(buf, "Go\<C-P>\<C-P>\<C-P>")
a84ed6d4aa9f patch 8.2.2937: popup test fails if rightleft feature not enabled
Bram Moolenaar <Bram@vim.org>
parents: 24677
diff changeset
1213 call term_wait(buf)
a84ed6d4aa9f patch 8.2.2937: popup test fails if rightleft feature not enabled
Bram Moolenaar <Bram@vim.org>
parents: 24677
diff changeset
1214 call VerifyScreenDump(buf, 'Test_pum_scrollbar_02', {'rows': 7})
a84ed6d4aa9f patch 8.2.2937: popup test fails if rightleft feature not enabled
Bram Moolenaar <Bram@vim.org>
parents: 24677
diff changeset
1215 endif
24677
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1216
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1217 call StopVimInTerminal(buf)
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1218 call delete('Xtest1')
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1219 endfunc
cac5f0bf7376 patch 8.2.2877: insufficient tests for popup menu rightleft
Bram Moolenaar <Bram@vim.org>
parents: 23772
diff changeset
1220
9742
0b0b9864c811 commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd
Christian Brabandt <cb@256bit.org>
parents: 9467
diff changeset
1221 " vim: shiftwidth=2 sts=2 expandtab