annotate src/testdir/test_ins_complete.vim @ 19047:a3fce2763e83 v8.2.0084

patch 8.2.0084: complete item "user_data" can only be a string Commit: https://github.com/vim/vim/commit/0892832bb6c7e322fcae8560eaad5a8140ee4a06 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 4 14:32:48 2020 +0100 patch 8.2.0084: complete item "user_data" can only be a string Problem: Complete item "user_data" can only be a string. Solution: Accept any type of variable. (closes https://github.com/vim/vim/issues/5412)
author Bram Moolenaar <Bram@vim.org>
date Sat, 04 Jan 2020 14:45:04 +0100
parents a9c47c623f4a
children 8645b73b3645
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18892
fb2d26bc8ca1 patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents: 17588
diff changeset
1 source screendump.vim
17588
1348696d07cd patch 8.1.1791: 'completeslash' also applies to globpath()
Bram Moolenaar <Bram@vim.org>
parents: 17553
diff changeset
2 source check.vim
12686
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 " Test for insert expansion
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 func Test_ins_complete()
12692
03a6aeea2096 patch 8.0.1224: still interference between test functions
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
6 edit test_ins_complete.vim
12788
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12728
diff changeset
7 " The files in the current directory interferes with the files
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12728
diff changeset
8 " used by this test. So use a separate directory for the test.
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12728
diff changeset
9 call mkdir('Xdir')
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12728
diff changeset
10 cd Xdir
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12728
diff changeset
11
12686
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 set ff=unix
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 call writefile(["test11\t36Gepeto\t/Tag/",
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 \ "asd\ttest11file\t36G",
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 \ "Makefile\tto\trun"], 'Xtestfile')
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 call writefile(['', 'start of testfile',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 \ 'ru',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 \ 'run1',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 \ 'run2',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 \ 'STARTTEST',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 \ 'ENDTEST',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 \ 'end of testfile'], 'Xtestdata')
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 set ff&
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 enew!
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 edit Xtestdata
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 new
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 call append(0, ['#include "Xtestfile"', ''])
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 call cursor(2, 1)
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 set cot=
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 set cpt=.,w
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 " add-expands (word from next line) from other window
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 exe "normal iru\<C-N>\<C-N>\<C-X>\<C-N>\<Esc>\<C-A>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 call assert_equal('run1 run3', getline('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 " add-expands (current buffer first)
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 exe "normal o\<C-P>\<C-X>\<C-N>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 call assert_equal('run3 run3', getline('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 " Local expansion, ends in an empty line (unless it becomes a global
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 " expansion)
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 exe "normal o\<C-X>\<C-P>\<C-P>\<C-P>\<C-P>\<C-P>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 call assert_equal('', getline('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 " starts Local and switches to global add-expansion
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 exe "normal o\<C-X>\<C-P>\<C-P>\<C-X>\<C-X>\<C-N>\<C-X>\<C-N>\<C-N>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 call assert_equal('run1 run2', getline('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 set cpt=.,w,i
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 " i-add-expands and switches to local
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 exe "normal OM\<C-N>\<C-X>\<C-N>\<C-X>\<C-N>\<C-X>\<C-X>\<C-X>\<C-P>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 call assert_equal("Makefile\tto\trun3", getline('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 " add-expands lines (it would end in an empty line if it didn't ignored
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 " itself)
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 exe "normal o\<C-X>\<C-L>\<C-X>\<C-L>\<C-P>\<C-P>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 call assert_equal("Makefile\tto\trun3", getline('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 call assert_equal("Makefile\tto\trun3", getline(line('.') - 1))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 set cpt=kXtestfile
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 " checks k-expansion, and file expansion (use Xtest11 instead of test11,
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 " because TEST11.OUT may match first on DOS)
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 write Xtest11.one
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 write Xtest11.two
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 exe "normal o\<C-N>\<Esc>IX\<Esc>A\<C-X>\<C-F>\<C-N>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 call assert_equal('Xtest11.two', getline('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 " use CTRL-X CTRL-F to complete Xtest11.one, remove it and then use CTRL-X
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 " CTRL-F again to verify this doesn't cause trouble.
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 exe "normal oXt\<C-X>\<C-F>\<BS>\<BS>\<BS>\<BS>\<BS>\<BS>\<BS>\<BS>\<C-X>\<C-F>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 call assert_equal('Xtest11.one', getline('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 normal ddk
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 set cpt=w
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 " checks make_cyclic in other window
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 exe "normal oST\<C-N>\<C-P>\<C-P>\<C-P>\<C-P>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 call assert_equal('STARTTEST', getline('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 set cpt=u nohid
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 " checks unloaded buffer expansion
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 only
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 exe "normal oEN\<C-N>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 call assert_equal('ENDTEST', getline('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 " checks adding mode abortion
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 exe "normal ounl\<C-N>\<C-X>\<C-X>\<C-P>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 call assert_equal('unless', getline('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 set cpt=t,d def=^\\k* tags=Xtestfile notagbsearch
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 " tag expansion, define add-expansion interrupted
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 exe "normal o\<C-X>\<C-]>\<C-X>\<C-D>\<C-X>\<C-D>\<C-X>\<C-X>\<C-D>\<C-X>\<C-D>\<C-X>\<C-D>\<C-X>\<C-D>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 call assert_equal('test11file 36Gepeto /Tag/ asd', getline('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 " t-expansion
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 exe "normal oa\<C-N>\<Esc>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 call assert_equal('asd', getline('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 %bw!
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 call delete('Xtestfile')
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 call delete('Xtest11.one')
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 call delete('Xtest11.two')
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 call delete('Xtestdata')
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98 set cpt& cot& def& tags& tagbsearch& hidden&
12788
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12728
diff changeset
99 cd ..
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12728
diff changeset
100 call delete('Xdir', 'rf')
12686
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 endfunc
12728
9c1659761fc3 patch 8.0.1242: function argument with only dash is seen as number zero
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
102
9c1659761fc3 patch 8.0.1242: function argument with only dash is seen as number zero
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
103 func Test_omni_dash()
9c1659761fc3 patch 8.0.1242: function argument with only dash is seen as number zero
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
104 func Omni(findstart, base)
9c1659761fc3 patch 8.0.1242: function argument with only dash is seen as number zero
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
105 if a:findstart
9c1659761fc3 patch 8.0.1242: function argument with only dash is seen as number zero
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
106 return 5
9c1659761fc3 patch 8.0.1242: function argument with only dash is seen as number zero
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
107 else
9c1659761fc3 patch 8.0.1242: function argument with only dash is seen as number zero
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
108 echom a:base
9c1659761fc3 patch 8.0.1242: function argument with only dash is seen as number zero
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
109 return ['-help', '-v']
9c1659761fc3 patch 8.0.1242: function argument with only dash is seen as number zero
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
110 endif
9c1659761fc3 patch 8.0.1242: function argument with only dash is seen as number zero
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
111 endfunc
9c1659761fc3 patch 8.0.1242: function argument with only dash is seen as number zero
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
112 set omnifunc=Omni
9c1659761fc3 patch 8.0.1242: function argument with only dash is seen as number zero
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
113 new
9c1659761fc3 patch 8.0.1242: function argument with only dash is seen as number zero
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
114 exe "normal Gofind -\<C-x>\<C-o>"
9c1659761fc3 patch 8.0.1242: function argument with only dash is seen as number zero
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
115 call assert_equal("\n-\nmatch 1 of 2", execute(':2mess'))
9c1659761fc3 patch 8.0.1242: function argument with only dash is seen as number zero
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
116
9c1659761fc3 patch 8.0.1242: function argument with only dash is seen as number zero
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
117 bwipe!
9c1659761fc3 patch 8.0.1242: function argument with only dash is seen as number zero
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
118 delfunc Omni
9c1659761fc3 patch 8.0.1242: function argument with only dash is seen as number zero
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
119 set omnifunc=
9c1659761fc3 patch 8.0.1242: function argument with only dash is seen as number zero
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
120 endfunc
13215
ae5f855a64be patch 8.0.1482: using feedkeys() does not work to test completion
Christian Brabandt <cb@256bit.org>
parents: 12788
diff changeset
121
14071
c1fcfafa8d1a patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents: 13238
diff changeset
122 func Test_completefunc_args()
c1fcfafa8d1a patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents: 13238
diff changeset
123 let s:args = []
c1fcfafa8d1a patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents: 13238
diff changeset
124 func! CompleteFunc(findstart, base)
c1fcfafa8d1a patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents: 13238
diff changeset
125 let s:args += [[a:findstart, empty(a:base)]]
c1fcfafa8d1a patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents: 13238
diff changeset
126 endfunc
c1fcfafa8d1a patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents: 13238
diff changeset
127 new
c1fcfafa8d1a patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents: 13238
diff changeset
128
c1fcfafa8d1a patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents: 13238
diff changeset
129 set completefunc=CompleteFunc
c1fcfafa8d1a patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents: 13238
diff changeset
130 call feedkeys("i\<C-X>\<C-U>\<Esc>", 'x')
14075
320956bddcef patch 8.1.0055: complete test has wrong order of arguments
Christian Brabandt <cb@256bit.org>
parents: 14071
diff changeset
131 call assert_equal([1, 1], s:args[0])
320956bddcef patch 8.1.0055: complete test has wrong order of arguments
Christian Brabandt <cb@256bit.org>
parents: 14071
diff changeset
132 call assert_equal(0, s:args[1][0])
14071
c1fcfafa8d1a patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents: 13238
diff changeset
133 set completefunc=
c1fcfafa8d1a patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents: 13238
diff changeset
134
c1fcfafa8d1a patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents: 13238
diff changeset
135 let s:args = []
c1fcfafa8d1a patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents: 13238
diff changeset
136 set omnifunc=CompleteFunc
c1fcfafa8d1a patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents: 13238
diff changeset
137 call feedkeys("i\<C-X>\<C-O>\<Esc>", 'x')
14075
320956bddcef patch 8.1.0055: complete test has wrong order of arguments
Christian Brabandt <cb@256bit.org>
parents: 14071
diff changeset
138 call assert_equal([1, 1], s:args[0])
320956bddcef patch 8.1.0055: complete test has wrong order of arguments
Christian Brabandt <cb@256bit.org>
parents: 14071
diff changeset
139 call assert_equal(0, s:args[1][0])
14071
c1fcfafa8d1a patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents: 13238
diff changeset
140 set omnifunc=
c1fcfafa8d1a patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents: 13238
diff changeset
141
c1fcfafa8d1a patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents: 13238
diff changeset
142 bwipe!
c1fcfafa8d1a patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents: 13238
diff changeset
143 unlet s:args
c1fcfafa8d1a patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents: 13238
diff changeset
144 delfunc CompleteFunc
c1fcfafa8d1a patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents: 13238
diff changeset
145 endfunc
c1fcfafa8d1a patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents: 13238
diff changeset
146
15416
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
147 func s:CompleteDone_CompleteFuncNone( findstart, base )
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
148 if a:findstart
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
149 return 0
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
150 endif
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
151
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
152 return v:none
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
153 endfunc
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
154
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14489
diff changeset
155 func s:CompleteDone_CompleteFuncDict( findstart, base )
13238
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
156 if a:findstart
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
157 return 0
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
158 endif
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
159
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
160 return {
19047
a3fce2763e83 patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents: 18900
diff changeset
161 \ 'words': [
a3fce2763e83 patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents: 18900
diff changeset
162 \ {
a3fce2763e83 patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents: 18900
diff changeset
163 \ 'word': 'aword',
a3fce2763e83 patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents: 18900
diff changeset
164 \ 'abbr': 'wrd',
a3fce2763e83 patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents: 18900
diff changeset
165 \ 'menu': 'extra text',
a3fce2763e83 patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents: 18900
diff changeset
166 \ 'info': 'words are cool',
a3fce2763e83 patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents: 18900
diff changeset
167 \ 'kind': 'W',
a3fce2763e83 patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents: 18900
diff changeset
168 \ 'user_data': 'test'
a3fce2763e83 patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents: 18900
diff changeset
169 \ }
a3fce2763e83 patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents: 18900
diff changeset
170 \ ]
a3fce2763e83 patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents: 18900
diff changeset
171 \ }
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14489
diff changeset
172 endfunc
13238
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
173
15416
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
174 func s:CompleteDone_CheckCompletedItemNone()
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
175 let s:called_completedone = 1
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
176 endfunc
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
177
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14489
diff changeset
178 func s:CompleteDone_CheckCompletedItemDict()
13238
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
179 call assert_equal( 'aword', v:completed_item[ 'word' ] )
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
180 call assert_equal( 'wrd', v:completed_item[ 'abbr' ] )
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
181 call assert_equal( 'extra text', v:completed_item[ 'menu' ] )
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
182 call assert_equal( 'words are cool', v:completed_item[ 'info' ] )
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
183 call assert_equal( 'W', v:completed_item[ 'kind' ] )
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
184 call assert_equal( 'test', v:completed_item[ 'user_data' ] )
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
185
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
186 let s:called_completedone = 1
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14489
diff changeset
187 endfunc
13238
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
188
15416
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
189 func Test_CompleteDoneNone()
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
190 au CompleteDone * :call <SID>CompleteDone_CheckCompletedItemNone()
16270
749a7c03de8d patch 8.1.1139: no test for what is fixed in patch 8.1.0716
Bram Moolenaar <Bram@vim.org>
parents: 15416
diff changeset
191 let oldline = join(map(range(&columns), 'nr2char(screenchar(&lines-1, v:val+1))'), '')
15416
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
192
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
193 set completefunc=<SID>CompleteDone_CompleteFuncNone
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
194 execute "normal a\<C-X>\<C-U>\<C-Y>"
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
195 set completefunc&
16270
749a7c03de8d patch 8.1.1139: no test for what is fixed in patch 8.1.0716
Bram Moolenaar <Bram@vim.org>
parents: 15416
diff changeset
196 let newline = join(map(range(&columns), 'nr2char(screenchar(&lines-1, v:val+1))'), '')
15416
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
197
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
198 call assert_true(s:called_completedone)
16270
749a7c03de8d patch 8.1.1139: no test for what is fixed in patch 8.1.0716
Bram Moolenaar <Bram@vim.org>
parents: 15416
diff changeset
199 call assert_equal(oldline, newline)
15416
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
200
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
201 let s:called_completedone = 0
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
202 au! CompleteDone
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
203 endfunc
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
204
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
205 func Test_CompleteDoneDict()
13238
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
206 au CompleteDone * :call <SID>CompleteDone_CheckCompletedItemDict()
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
207
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
208 set completefunc=<SID>CompleteDone_CompleteFuncDict
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
209 execute "normal a\<C-X>\<C-U>\<C-Y>"
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
210 set completefunc&
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
211
15416
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
212 call assert_equal('test', v:completed_item[ 'user_data' ])
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
213 call assert_true(s:called_completedone)
13238
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
214
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
215 let s:called_completedone = 0
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
216 au! CompleteDone
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
217 endfunc
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
218
15416
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
219 func s:CompleteDone_CompleteFuncDictNoUserData(findstart, base)
13238
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
220 if a:findstart
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
221 return 0
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
222 endif
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
223
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
224 return {
19047
a3fce2763e83 patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents: 18900
diff changeset
225 \ 'words': [
a3fce2763e83 patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents: 18900
diff changeset
226 \ {
a3fce2763e83 patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents: 18900
diff changeset
227 \ 'word': 'aword',
a3fce2763e83 patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents: 18900
diff changeset
228 \ 'abbr': 'wrd',
a3fce2763e83 patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents: 18900
diff changeset
229 \ 'menu': 'extra text',
a3fce2763e83 patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents: 18900
diff changeset
230 \ 'info': 'words are cool',
a3fce2763e83 patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents: 18900
diff changeset
231 \ 'kind': 'W',
a3fce2763e83 patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents: 18900
diff changeset
232 \ 'user_data': ['one', 'two'],
a3fce2763e83 patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents: 18900
diff changeset
233 \ }
a3fce2763e83 patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents: 18900
diff changeset
234 \ ]
a3fce2763e83 patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents: 18900
diff changeset
235 \ }
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14489
diff changeset
236 endfunc
13238
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
237
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14489
diff changeset
238 func s:CompleteDone_CheckCompletedItemDictNoUserData()
13238
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
239 call assert_equal( 'aword', v:completed_item[ 'word' ] )
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
240 call assert_equal( 'wrd', v:completed_item[ 'abbr' ] )
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
241 call assert_equal( 'extra text', v:completed_item[ 'menu' ] )
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
242 call assert_equal( 'words are cool', v:completed_item[ 'info' ] )
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
243 call assert_equal( 'W', v:completed_item[ 'kind' ] )
19047
a3fce2763e83 patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents: 18900
diff changeset
244 call assert_equal( ['one', 'two'], v:completed_item[ 'user_data' ] )
13238
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
245
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
246 let s:called_completedone = 1
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14489
diff changeset
247 endfunc
13238
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
248
15416
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
249 func Test_CompleteDoneDictNoUserData()
13238
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
250 au CompleteDone * :call <SID>CompleteDone_CheckCompletedItemDictNoUserData()
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
251
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
252 set completefunc=<SID>CompleteDone_CompleteFuncDictNoUserData
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
253 execute "normal a\<C-X>\<C-U>\<C-Y>"
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
254 set completefunc&
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
255
19047
a3fce2763e83 patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents: 18900
diff changeset
256 call assert_equal(['one', 'two'], v:completed_item[ 'user_data' ])
15416
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
257 call assert_true(s:called_completedone)
13238
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
258
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
259 let s:called_completedone = 0
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
260 au! CompleteDone
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
261 endfunc
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
262
15416
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
263 func s:CompleteDone_CompleteFuncList(findstart, base)
13238
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
264 if a:findstart
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
265 return 0
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
266 endif
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
267
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
268 return [ 'aword' ]
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14489
diff changeset
269 endfunc
13238
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
270
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14489
diff changeset
271 func s:CompleteDone_CheckCompletedItemList()
13238
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
272 call assert_equal( 'aword', v:completed_item[ 'word' ] )
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
273 call assert_equal( '', v:completed_item[ 'abbr' ] )
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
274 call assert_equal( '', v:completed_item[ 'menu' ] )
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
275 call assert_equal( '', v:completed_item[ 'info' ] )
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
276 call assert_equal( '', v:completed_item[ 'kind' ] )
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
277 call assert_equal( '', v:completed_item[ 'user_data' ] )
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
278
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
279 let s:called_completedone = 1
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 14489
diff changeset
280 endfunc
13238
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
281
15416
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
282 func Test_CompleteDoneList()
13238
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
283 au CompleteDone * :call <SID>CompleteDone_CheckCompletedItemList()
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
284
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
285 set completefunc=<SID>CompleteDone_CompleteFuncList
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
286 execute "normal a\<C-X>\<C-U>\<C-Y>"
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
287 set completefunc&
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
288
15416
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
289 call assert_equal('', v:completed_item[ 'user_data' ])
5f8ddd2a7b92 patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
290 call assert_true(s:called_completedone)
13238
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
291
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
292 let s:called_completedone = 0
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
293 au! CompleteDone
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
294 endfunc
e0dcfd3dbb52 patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents: 13215
diff changeset
295
14489
cda216729f9b patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents: 14075
diff changeset
296 func Test_CompleteDone_undo()
cda216729f9b patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents: 14075
diff changeset
297 au CompleteDone * call append(0, "prepend1")
cda216729f9b patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents: 14075
diff changeset
298 new
cda216729f9b patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents: 14075
diff changeset
299 call setline(1, ["line1", "line2"])
cda216729f9b patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents: 14075
diff changeset
300 call feedkeys("Go\<C-X>\<C-N>\<CR>\<ESC>", "tx")
cda216729f9b patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents: 14075
diff changeset
301 call assert_equal(["prepend1", "line1", "line2", "line1", ""],
cda216729f9b patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents: 14075
diff changeset
302 \ getline(1, '$'))
cda216729f9b patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents: 14075
diff changeset
303 undo
cda216729f9b patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents: 14075
diff changeset
304 call assert_equal(["line1", "line2"], getline(1, '$'))
cda216729f9b patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents: 14075
diff changeset
305 bwipe!
cda216729f9b patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents: 14075
diff changeset
306 au! CompleteDone
cda216729f9b patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents: 14075
diff changeset
307 endfunc
cda216729f9b patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents: 14075
diff changeset
308
13215
ae5f855a64be patch 8.0.1482: using feedkeys() does not work to test completion
Christian Brabandt <cb@256bit.org>
parents: 12788
diff changeset
309 " Check that when using feedkeys() typeahead does not interrupt searching for
ae5f855a64be patch 8.0.1482: using feedkeys() does not work to test completion
Christian Brabandt <cb@256bit.org>
parents: 12788
diff changeset
310 " completions.
ae5f855a64be patch 8.0.1482: using feedkeys() does not work to test completion
Christian Brabandt <cb@256bit.org>
parents: 12788
diff changeset
311 func Test_compl_feedkeys()
ae5f855a64be patch 8.0.1482: using feedkeys() does not work to test completion
Christian Brabandt <cb@256bit.org>
parents: 12788
diff changeset
312 new
ae5f855a64be patch 8.0.1482: using feedkeys() does not work to test completion
Christian Brabandt <cb@256bit.org>
parents: 12788
diff changeset
313 set completeopt=menuone,noselect
ae5f855a64be patch 8.0.1482: using feedkeys() does not work to test completion
Christian Brabandt <cb@256bit.org>
parents: 12788
diff changeset
314 call feedkeys("ajump ju\<C-X>\<C-N>\<C-P>\<ESC>", "tx")
ae5f855a64be patch 8.0.1482: using feedkeys() does not work to test completion
Christian Brabandt <cb@256bit.org>
parents: 12788
diff changeset
315 call assert_equal("jump jump", getline(1))
ae5f855a64be patch 8.0.1482: using feedkeys() does not work to test completion
Christian Brabandt <cb@256bit.org>
parents: 12788
diff changeset
316 bwipe!
ae5f855a64be patch 8.0.1482: using feedkeys() does not work to test completion
Christian Brabandt <cb@256bit.org>
parents: 12788
diff changeset
317 set completeopt&
ae5f855a64be patch 8.0.1482: using feedkeys() does not work to test completion
Christian Brabandt <cb@256bit.org>
parents: 12788
diff changeset
318 endfunc
17468
fa6c9047ec70 patch 8.1.1732: completion in cmdwin does not work for buffer-local commands
Bram Moolenaar <Bram@vim.org>
parents: 16270
diff changeset
319
fa6c9047ec70 patch 8.1.1732: completion in cmdwin does not work for buffer-local commands
Bram Moolenaar <Bram@vim.org>
parents: 16270
diff changeset
320 func Test_compl_in_cmdwin()
fa6c9047ec70 patch 8.1.1732: completion in cmdwin does not work for buffer-local commands
Bram Moolenaar <Bram@vim.org>
parents: 16270
diff changeset
321 set wildmenu wildchar=<Tab>
fa6c9047ec70 patch 8.1.1732: completion in cmdwin does not work for buffer-local commands
Bram Moolenaar <Bram@vim.org>
parents: 16270
diff changeset
322 com! -nargs=1 -complete=command GetInput let input = <q-args>
fa6c9047ec70 patch 8.1.1732: completion in cmdwin does not work for buffer-local commands
Bram Moolenaar <Bram@vim.org>
parents: 16270
diff changeset
323 com! -buffer TestCommand echo 'TestCommand'
fa6c9047ec70 patch 8.1.1732: completion in cmdwin does not work for buffer-local commands
Bram Moolenaar <Bram@vim.org>
parents: 16270
diff changeset
324
fa6c9047ec70 patch 8.1.1732: completion in cmdwin does not work for buffer-local commands
Bram Moolenaar <Bram@vim.org>
parents: 16270
diff changeset
325 let input = ''
fa6c9047ec70 patch 8.1.1732: completion in cmdwin does not work for buffer-local commands
Bram Moolenaar <Bram@vim.org>
parents: 16270
diff changeset
326 call feedkeys("q:iGetInput T\<C-x>\<C-v>\<CR>", 'tx!')
fa6c9047ec70 patch 8.1.1732: completion in cmdwin does not work for buffer-local commands
Bram Moolenaar <Bram@vim.org>
parents: 16270
diff changeset
327 call assert_equal('TestCommand', input)
fa6c9047ec70 patch 8.1.1732: completion in cmdwin does not work for buffer-local commands
Bram Moolenaar <Bram@vim.org>
parents: 16270
diff changeset
328
fa6c9047ec70 patch 8.1.1732: completion in cmdwin does not work for buffer-local commands
Bram Moolenaar <Bram@vim.org>
parents: 16270
diff changeset
329 let input = ''
fa6c9047ec70 patch 8.1.1732: completion in cmdwin does not work for buffer-local commands
Bram Moolenaar <Bram@vim.org>
parents: 16270
diff changeset
330 call feedkeys("q::GetInput T\<Tab>\<CR>:q\<CR>", 'tx!')
fa6c9047ec70 patch 8.1.1732: completion in cmdwin does not work for buffer-local commands
Bram Moolenaar <Bram@vim.org>
parents: 16270
diff changeset
331 call assert_equal('T', input)
fa6c9047ec70 patch 8.1.1732: completion in cmdwin does not work for buffer-local commands
Bram Moolenaar <Bram@vim.org>
parents: 16270
diff changeset
332
fa6c9047ec70 patch 8.1.1732: completion in cmdwin does not work for buffer-local commands
Bram Moolenaar <Bram@vim.org>
parents: 16270
diff changeset
333 delcom TestCommand
fa6c9047ec70 patch 8.1.1732: completion in cmdwin does not work for buffer-local commands
Bram Moolenaar <Bram@vim.org>
parents: 16270
diff changeset
334 delcom GetInput
fa6c9047ec70 patch 8.1.1732: completion in cmdwin does not work for buffer-local commands
Bram Moolenaar <Bram@vim.org>
parents: 16270
diff changeset
335 set wildmenu& wildchar&
fa6c9047ec70 patch 8.1.1732: completion in cmdwin does not work for buffer-local commands
Bram Moolenaar <Bram@vim.org>
parents: 16270
diff changeset
336 endfunc
17543
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
337
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
338 " Test for insert path completion with completeslash option
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
339 func Test_ins_completeslash()
17588
1348696d07cd patch 8.1.1791: 'completeslash' also applies to globpath()
Bram Moolenaar <Bram@vim.org>
parents: 17553
diff changeset
340 CheckMSWindows
17543
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
341
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
342 call mkdir('Xdir')
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
343 let orig_shellslash = &shellslash
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
344 set cpt&
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
345 new
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
346
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
347 set noshellslash
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
348
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
349 set completeslash=
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
350 exe "normal oXd\<C-X>\<C-F>"
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
351 call assert_equal('Xdir\', getline('.'))
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
352
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
353 set completeslash=backslash
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
354 exe "normal oXd\<C-X>\<C-F>"
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
355 call assert_equal('Xdir\', getline('.'))
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
356
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
357 set completeslash=slash
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
358 exe "normal oXd\<C-X>\<C-F>"
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
359 call assert_equal('Xdir/', getline('.'))
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
360
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
361 set shellslash
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
362
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
363 set completeslash=
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
364 exe "normal oXd\<C-X>\<C-F>"
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
365 call assert_equal('Xdir/', getline('.'))
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
366
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
367 set completeslash=backslash
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
368 exe "normal oXd\<C-X>\<C-F>"
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
369 call assert_equal('Xdir\', getline('.'))
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
370
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
371 set completeslash=slash
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
372 exe "normal oXd\<C-X>\<C-F>"
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
373 call assert_equal('Xdir/', getline('.'))
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
374 %bw!
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
375 call delete('Xdir', 'rf')
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
376
17588
1348696d07cd patch 8.1.1791: 'completeslash' also applies to globpath()
Bram Moolenaar <Bram@vim.org>
parents: 17553
diff changeset
377 set noshellslash
1348696d07cd patch 8.1.1791: 'completeslash' also applies to globpath()
Bram Moolenaar <Bram@vim.org>
parents: 17553
diff changeset
378 set completeslash=slash
1348696d07cd patch 8.1.1791: 'completeslash' also applies to globpath()
Bram Moolenaar <Bram@vim.org>
parents: 17553
diff changeset
379 call assert_true(stridx(globpath(&rtp, 'syntax/*.vim', 1, 1)[0], '\') != -1)
1348696d07cd patch 8.1.1791: 'completeslash' also applies to globpath()
Bram Moolenaar <Bram@vim.org>
parents: 17553
diff changeset
380
17543
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
381 let &shellslash = orig_shellslash
17588
1348696d07cd patch 8.1.1791: 'completeslash' also applies to globpath()
Bram Moolenaar <Bram@vim.org>
parents: 17553
diff changeset
382 set completeslash=
17543
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
383 endfunc
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17468
diff changeset
384
18892
fb2d26bc8ca1 patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents: 17588
diff changeset
385 func Test_pum_with_folds_two_tabs()
fb2d26bc8ca1 patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents: 17588
diff changeset
386 CheckScreendump
fb2d26bc8ca1 patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents: 17588
diff changeset
387
fb2d26bc8ca1 patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents: 17588
diff changeset
388 let lines =<< trim END
fb2d26bc8ca1 patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents: 17588
diff changeset
389 set fdm=marker
fb2d26bc8ca1 patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents: 17588
diff changeset
390 call setline(1, ['" x {{{1', '" a some text'])
fb2d26bc8ca1 patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents: 17588
diff changeset
391 call setline(3, range(&lines)->map({_, val -> '" a' .. val}))
fb2d26bc8ca1 patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents: 17588
diff changeset
392 norm! zm
fb2d26bc8ca1 patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents: 17588
diff changeset
393 tab sp
fb2d26bc8ca1 patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents: 17588
diff changeset
394 call feedkeys('2Gzv', 'xt')
fb2d26bc8ca1 patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents: 17588
diff changeset
395 call feedkeys("0fa", 'xt')
fb2d26bc8ca1 patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents: 17588
diff changeset
396 END
fb2d26bc8ca1 patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents: 17588
diff changeset
397
fb2d26bc8ca1 patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents: 17588
diff changeset
398 call writefile(lines, 'Xpumscript')
fb2d26bc8ca1 patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents: 17588
diff changeset
399 let buf = RunVimInTerminal('-S Xpumscript', #{rows: 10})
fb2d26bc8ca1 patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents: 17588
diff changeset
400 call term_wait(buf, 100)
fb2d26bc8ca1 patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents: 17588
diff changeset
401 call term_sendkeys(buf, "a\<C-N>")
fb2d26bc8ca1 patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents: 17588
diff changeset
402 call VerifyScreenDump(buf, 'Test_pum_with_folds_two_tabs', {})
fb2d26bc8ca1 patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents: 17588
diff changeset
403
fb2d26bc8ca1 patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents: 17588
diff changeset
404 call term_sendkeys(buf, "\<Esc>")
fb2d26bc8ca1 patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents: 17588
diff changeset
405 call StopVimInTerminal(buf)
fb2d26bc8ca1 patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents: 17588
diff changeset
406 call delete('Xpumscript')
fb2d26bc8ca1 patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents: 17588
diff changeset
407 endfunc
18900
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
408
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
409 func Test_pum_with_preview_win()
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
410 CheckScreendump
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
411
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
412 let lines =<< trim END
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
413 funct Omni_test(findstart, base)
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
414 if a:findstart
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
415 return col(".") - 1
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
416 endif
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
417 return [#{word: "one", info: "1info"}, #{word: "two", info: "2info"}, #{word: "three", info: "3info"}]
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
418 endfunc
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
419 set omnifunc=Omni_test
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
420 set completeopt+=longest
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
421 END
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
422
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
423 call writefile(lines, 'Xpreviewscript')
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
424 let buf = RunVimInTerminal('-S Xpreviewscript', #{rows: 12})
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
425 call term_wait(buf, 100)
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
426 call term_sendkeys(buf, "Gi\<C-X>\<C-O>")
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
427 call term_wait(buf, 100)
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
428 call term_sendkeys(buf, "\<C-N>")
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
429 call VerifyScreenDump(buf, 'Test_pum_with_preview_win', {})
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
430
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
431 call term_sendkeys(buf, "\<Esc>")
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
432 call StopVimInTerminal(buf)
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
433 call delete('Xpreviewscript')
a9c47c623f4a patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents: 18892
diff changeset
434 endfunc