Mercurial > vim
annotate src/testdir/test_ins_complete.vim @ 21453:40210bb08e3f v8.2.1277
patch 8.2.1277: tests on Travis do not run with EXITFREE
Commit: https://github.com/vim/vim/commit/7a87b4e3fe91c18a616536fe49154c4bb3da0a93
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jul 23 14:59:07 2020 +0200
patch 8.2.1277: tests on Travis do not run with EXITFREE
Problem: Tests on Travis do not run with EXITFREE.
Solution: Add EXITFREE to all builds to uncover any mistakes.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 23 Jul 2020 15:00:04 +0200 |
parents | bce10d039e06 |
children | 08940efa6b4e |
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 |
19199
8cbadf7fb9d4
patch 8.2.0158: triggering CompleteDone earlier is not backwards compatible
Bram Moolenaar <Bram@vim.org>
parents:
19127
diff
changeset
|
178 func s:CompleteDone_CheckCompletedItemDict(pre) |
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 |
19199
8cbadf7fb9d4
patch 8.2.0158: triggering CompleteDone earlier is not backwards compatible
Bram Moolenaar <Bram@vim.org>
parents:
19127
diff
changeset
|
186 if a:pre |
8cbadf7fb9d4
patch 8.2.0158: triggering CompleteDone earlier is not backwards compatible
Bram Moolenaar <Bram@vim.org>
parents:
19127
diff
changeset
|
187 call assert_equal('function', complete_info().mode) |
8cbadf7fb9d4
patch 8.2.0158: triggering CompleteDone earlier is not backwards compatible
Bram Moolenaar <Bram@vim.org>
parents:
19127
diff
changeset
|
188 endif |
19127
0ee48dc3f8bc
patch 8.2.0123: complete_info() does not work when CompleteDone is triggered
Bram Moolenaar <Bram@vim.org>
parents:
19055
diff
changeset
|
189 |
13238
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
190 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
|
191 endfunc |
13238
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
192 |
15416
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
193 func Test_CompleteDoneNone() |
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
194 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
|
195 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
|
196 |
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
197 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
|
198 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
|
199 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
|
200 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
|
201 |
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
202 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
|
203 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
|
204 |
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
205 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
|
206 au! CompleteDone |
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
207 endfunc |
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
208 |
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
209 func Test_CompleteDoneDict() |
19199
8cbadf7fb9d4
patch 8.2.0158: triggering CompleteDone earlier is not backwards compatible
Bram Moolenaar <Bram@vim.org>
parents:
19127
diff
changeset
|
210 au CompleteDonePre * :call <SID>CompleteDone_CheckCompletedItemDict(1) |
8cbadf7fb9d4
patch 8.2.0158: triggering CompleteDone earlier is not backwards compatible
Bram Moolenaar <Bram@vim.org>
parents:
19127
diff
changeset
|
211 au CompleteDone * :call <SID>CompleteDone_CheckCompletedItemDict(0) |
13238
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
212 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
213 set completefunc=<SID>CompleteDone_CompleteFuncDict |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
214 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
|
215 set completefunc& |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
216 |
15416
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
217 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
|
218 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
|
219 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
220 let s:called_completedone = 0 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
221 au! CompleteDone |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
222 endfunc |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
223 |
15416
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
224 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
|
225 if a:findstart |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
226 return 0 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
227 endif |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
228 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
229 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
|
230 \ 'words': [ |
a3fce2763e83
patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents:
18900
diff
changeset
|
231 \ { |
a3fce2763e83
patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents:
18900
diff
changeset
|
232 \ '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
|
233 \ '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
|
234 \ '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
|
235 \ '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
|
236 \ '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
|
237 \ '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
|
238 \ } |
a3fce2763e83
patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents:
18900
diff
changeset
|
239 \ ] |
a3fce2763e83
patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents:
18900
diff
changeset
|
240 \ } |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14489
diff
changeset
|
241 endfunc |
13238
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
242 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14489
diff
changeset
|
243 func s:CompleteDone_CheckCompletedItemDictNoUserData() |
13238
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
244 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
|
245 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
|
246 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
|
247 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
|
248 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
|
249 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
|
250 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
251 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
|
252 endfunc |
13238
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
253 |
15416
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
254 func Test_CompleteDoneDictNoUserData() |
13238
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
255 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
|
256 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
257 set completefunc=<SID>CompleteDone_CompleteFuncDictNoUserData |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
258 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
|
259 set completefunc& |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
260 |
19047
a3fce2763e83
patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents:
18900
diff
changeset
|
261 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
|
262 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
|
263 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
264 let s:called_completedone = 0 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
265 au! CompleteDone |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
266 endfunc |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
267 |
15416
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
268 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
|
269 if a:findstart |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
270 return 0 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
271 endif |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
272 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
273 return [ 'aword' ] |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14489
diff
changeset
|
274 endfunc |
13238
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
275 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14489
diff
changeset
|
276 func s:CompleteDone_CheckCompletedItemList() |
13238
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
277 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
|
278 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
|
279 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
|
280 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
|
281 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
|
282 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
|
283 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
284 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
|
285 endfunc |
13238
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
286 |
15416
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
287 func Test_CompleteDoneList() |
13238
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
288 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
|
289 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
290 set completefunc=<SID>CompleteDone_CompleteFuncList |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
291 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
|
292 set completefunc& |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
293 |
15416
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
294 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
|
295 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
|
296 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
297 let s:called_completedone = 0 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
298 au! CompleteDone |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
299 endfunc |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
300 |
14489
cda216729f9b
patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents:
14075
diff
changeset
|
301 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
|
302 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
|
303 new |
cda216729f9b
patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents:
14075
diff
changeset
|
304 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
|
305 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
|
306 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
|
307 \ getline(1, '$')) |
cda216729f9b
patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents:
14075
diff
changeset
|
308 undo |
cda216729f9b
patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents:
14075
diff
changeset
|
309 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
|
310 bwipe! |
cda216729f9b
patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents:
14075
diff
changeset
|
311 au! CompleteDone |
cda216729f9b
patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents:
14075
diff
changeset
|
312 endfunc |
cda216729f9b
patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents:
14075
diff
changeset
|
313 |
13215
ae5f855a64be
patch 8.0.1482: using feedkeys() does not work to test completion
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
314 " 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
|
315 " completions. |
ae5f855a64be
patch 8.0.1482: using feedkeys() does not work to test completion
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
316 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
|
317 new |
ae5f855a64be
patch 8.0.1482: using feedkeys() does not work to test completion
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
318 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
|
319 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
|
320 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
|
321 bwipe! |
ae5f855a64be
patch 8.0.1482: using feedkeys() does not work to test completion
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
322 set completeopt& |
ae5f855a64be
patch 8.0.1482: using feedkeys() does not work to test completion
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
323 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
|
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 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
|
326 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
|
327 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
|
328 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
|
329 |
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 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
|
331 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
|
332 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
|
333 |
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 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
|
335 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
|
336 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
|
337 |
fa6c9047ec70
patch 8.1.1732: completion in cmdwin does not work for buffer-local commands
Bram Moolenaar <Bram@vim.org>
parents:
16270
diff
changeset
|
338 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
|
339 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
|
340 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
|
341 endfunc |
17543
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
342 |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
343 " 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
|
344 func Test_ins_completeslash() |
17588
1348696d07cd
patch 8.1.1791: 'completeslash' also applies to globpath()
Bram Moolenaar <Bram@vim.org>
parents:
17553
diff
changeset
|
345 CheckMSWindows |
17543
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 call mkdir('Xdir') |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
348 let orig_shellslash = &shellslash |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
349 set cpt& |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
350 new |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
351 |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
352 set noshellslash |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
353 |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
354 set completeslash= |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
355 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
|
356 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
|
357 |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
358 set completeslash=backslash |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
359 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
|
360 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
|
361 |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
362 set completeslash=slash |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
363 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
|
364 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
|
365 |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
366 set shellslash |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
367 |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
368 set completeslash= |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
369 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
|
370 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
|
371 |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
372 set completeslash=backslash |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
373 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
|
374 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
|
375 |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
376 set completeslash=slash |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
377 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
|
378 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
|
379 %bw! |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
380 call delete('Xdir', 'rf') |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
381 |
17588
1348696d07cd
patch 8.1.1791: 'completeslash' also applies to globpath()
Bram Moolenaar <Bram@vim.org>
parents:
17553
diff
changeset
|
382 set noshellslash |
1348696d07cd
patch 8.1.1791: 'completeslash' also applies to globpath()
Bram Moolenaar <Bram@vim.org>
parents:
17553
diff
changeset
|
383 set completeslash=slash |
1348696d07cd
patch 8.1.1791: 'completeslash' also applies to globpath()
Bram Moolenaar <Bram@vim.org>
parents:
17553
diff
changeset
|
384 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
|
385 |
17543
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
386 let &shellslash = orig_shellslash |
17588
1348696d07cd
patch 8.1.1791: 'completeslash' also applies to globpath()
Bram Moolenaar <Bram@vim.org>
parents:
17553
diff
changeset
|
387 set completeslash= |
17543
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
388 endfunc |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
389 |
18892
fb2d26bc8ca1
patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
390 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
|
391 CheckScreendump |
fb2d26bc8ca1
patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
392 |
fb2d26bc8ca1
patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
393 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
|
394 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
|
395 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
|
396 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
|
397 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
|
398 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
|
399 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
|
400 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
|
401 END |
fb2d26bc8ca1
patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
402 |
fb2d26bc8ca1
patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
403 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
|
404 let buf = RunVimInTerminal('-S Xpumscript', #{rows: 10}) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19932
diff
changeset
|
405 call TermWait(buf, 50) |
18892
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 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
|
407 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
|
408 |
fb2d26bc8ca1
patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
409 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
|
410 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
|
411 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
|
412 endfunc |
18900
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
413 |
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
414 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
|
415 CheckScreendump |
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
416 |
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
417 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
|
418 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
|
419 if a:findstart |
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
420 return col(".") - 1 |
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
421 endif |
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
422 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
|
423 endfunc |
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
424 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
|
425 set completeopt+=longest |
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
426 END |
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
427 |
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
428 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
|
429 let buf = RunVimInTerminal('-S Xpreviewscript', #{rows: 12}) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19932
diff
changeset
|
430 call TermWait(buf, 50) |
18900
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, "Gi\<C-X>\<C-O>") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19932
diff
changeset
|
432 call TermWait(buf, 100) |
18900
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
433 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
|
434 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
|
435 |
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
436 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
|
437 call StopVimInTerminal(buf) |
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
438 call delete('Xpreviewscript') |
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
439 endfunc |
19055
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
440 |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
441 " Test for inserting the tag search pattern in insert mode |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
442 func Test_ins_compl_tag_sft() |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
443 call writefile([ |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
444 \ "!_TAG_FILE_ENCODING\tutf-8\t//", |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
445 \ "first\tXfoo\t/^int first() {}$/", |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
446 \ "second\tXfoo\t/^int second() {}$/", |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
447 \ "third\tXfoo\t/^int third() {}$/"], |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
448 \ 'Xtags') |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
449 set tags=Xtags |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
450 let code =<< trim [CODE] |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
451 int first() {} |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
452 int second() {} |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
453 int third() {} |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
454 [CODE] |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
455 call writefile(code, 'Xfoo') |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
456 |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
457 enew |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
458 set showfulltag |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
459 exe "normal isec\<C-X>\<C-]>\<C-N>\<CR>" |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
460 call assert_equal('int second() {}', getline(1)) |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
461 set noshowfulltag |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
462 |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
463 call delete('Xtags') |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
464 call delete('Xfoo') |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
465 set tags& |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
466 %bwipe! |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
467 endfunc |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
468 |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
469 " Test for 'completefunc' deleting text |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
470 func Test_completefunc_error() |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
471 new |
20120
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
472 " delete text when called for the first time |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
473 func CompleteFunc(findstart, base) |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
474 if a:findstart == 1 |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
475 normal dd |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
476 return col('.') - 1 |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
477 endif |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
478 return ['a', 'b'] |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
479 endfunc |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
480 set completefunc=CompleteFunc |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
481 call setline(1, ['', 'abcd', '']) |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
482 call assert_fails('exe "normal 2G$a\<C-X>\<C-U>"', 'E840:') |
20120
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
483 |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
484 " delete text when called for the second time |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
485 func CompleteFunc2(findstart, base) |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
486 if a:findstart == 1 |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
487 return col('.') - 1 |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
488 endif |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
489 normal dd |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
490 return ['a', 'b'] |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
491 endfunc |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
492 set completefunc=CompleteFunc2 |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
493 call setline(1, ['', 'abcd', '']) |
20229
06a1dd50463e
patch 8.2.0670: cannot change window when evaluating 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents:
20199
diff
changeset
|
494 call assert_fails('exe "normal 2G$a\<C-X>\<C-U>"', 'E578:') |
20120
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
495 |
20285
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
496 " Jump to a different window from the complete function |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
497 " TODO: The following test causes an ASAN failure. Once this issue is |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
498 " addressed, enable the following test. |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
499 "func! CompleteFunc(findstart, base) |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
500 " if a:findstart == 1 |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
501 " return col('.') - 1 |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
502 " endif |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
503 " wincmd p |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
504 " return ['a', 'b'] |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
505 "endfunc |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
506 "set completefunc=CompleteFunc |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
507 "new |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
508 "call assert_fails('exe "normal a\<C-X>\<C-U>"', 'E839:') |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
509 "close! |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
510 |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
511 set completefunc& |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
512 delfunc CompleteFunc |
20120
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
513 delfunc CompleteFunc2 |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
514 close! |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
515 endfunc |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
516 |
20285
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
517 " Test for returning non-string values from 'completefunc' |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
518 func Test_completefunc_invalid_data() |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
519 new |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
520 func! CompleteFunc(findstart, base) |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
521 if a:findstart == 1 |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
522 return col('.') - 1 |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
523 endif |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
524 return [{}, '', 'moon'] |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
525 endfunc |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
526 set completefunc=CompleteFunc |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
527 exe "normal i\<C-X>\<C-U>" |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
528 call assert_equal('moon', getline(1)) |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
529 set completefunc& |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
530 close! |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
531 endfunc |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
532 |
20120
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
533 " Test for errors in using complete() function |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
534 func Test_complete_func_error() |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
535 call assert_fails('call complete(1, ["a"])', 'E785:') |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
536 func ListColors() |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
537 call complete(col('.'), "blue") |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
538 endfunc |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
539 call assert_fails('exe "normal i\<C-R>=ListColors()\<CR>"', 'E474:') |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
540 func ListMonths() |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
541 call complete(col('.'), test_null_list()) |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
542 endfunc |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
543 call assert_fails('exe "normal i\<C-R>=ListMonths()\<CR>"', 'E474:') |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
544 delfunc ListColors |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
545 delfunc ListMonths |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
546 call assert_fails('call complete_info({})', 'E714:') |
20285
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
547 call assert_equal([], complete_info(['items']).items) |
20120
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
548 endfunc |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
549 |
20199
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
550 " Test for completing words following a completed word in a line |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
551 func Test_complete_wrapscan() |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
552 " complete words from another buffer |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
553 new |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
554 call setline(1, ['one two', 'three four']) |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
555 new |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
556 setlocal complete=w |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
557 call feedkeys("itw\<C-N>\<C-X>\<C-N>\<C-X>\<C-N>\<C-X>\<C-N>", 'xt') |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
558 call assert_equal('two three four', getline(1)) |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
559 close! |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
560 " complete words from the current buffer |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
561 setlocal complete=. |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
562 %d |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
563 call setline(1, ['one two', '']) |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
564 call cursor(2, 1) |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
565 call feedkeys("ion\<C-N>\<C-X>\<C-N>\<C-X>\<C-N>\<C-X>\<C-N>", 'xt') |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
566 call assert_equal('one two one two', getline(2)) |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
567 close! |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
568 endfunc |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
569 |
20285
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
570 " Test for completing special characters |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
571 func Test_complete_special_chars() |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
572 new |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
573 call setline(1, 'int .*[-\^$ func float') |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
574 call feedkeys("oin\<C-X>\<C-P>\<C-X>\<C-P>\<C-X>\<C-P>", 'xt') |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
575 call assert_equal('int .*[-\^$ func float', getline(2)) |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
576 close! |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
577 endfunc |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
578 |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
579 " Test for completion when text is wrapped across lines. |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
580 func Test_complete_across_line() |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
581 new |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
582 call setline(1, ['red green blue', 'one two three']) |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
583 setlocal textwidth=20 |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
584 exe "normal 2G$a re\<C-X>\<C-P>\<C-X>\<C-P>\<C-X>\<C-P>\<C-X>\<C-P>" |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
585 call assert_equal(['one two three red', 'green blue one'], getline(2, '$')) |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
586 close! |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
587 endfunc |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
588 |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
589 " Test for using CTRL-L to add one character when completing matching |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
590 func Test_complete_add_onechar() |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
591 new |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
592 call setline(1, ['wool', 'woodwork']) |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
593 call feedkeys("Gowoo\<C-P>\<C-P>\<C-P>\<C-L>f", 'xt') |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
594 call assert_equal('woof', getline(3)) |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
595 |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
596 " use 'ignorecase' and backspace to erase characters from the prefix string |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
597 " and then add letters using CTRL-L |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
598 %d |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
599 set ignorecase backspace=2 |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
600 setlocal complete=. |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
601 call setline(1, ['workhorse', 'workload']) |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
602 normal Go |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
603 exe "normal aWOR\<C-P>\<bs>\<bs>\<bs>\<bs>\<bs>\<bs>\<C-L>r\<C-L>\<C-L>" |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
604 call assert_equal('workh', getline(3)) |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
605 set ignorecase& backspace& |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
606 close! |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
607 endfunc |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
608 |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
609 " Test insert completion with 'cindent' (adjust the indent) |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
610 func Test_complete_with_cindent() |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
611 new |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
612 setlocal cindent |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
613 call setline(1, ['if (i == 1)', " j = 2;"]) |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
614 exe "normal Go{\<CR>i\<C-X>\<C-L>\<C-X>\<C-L>\<CR>}" |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
615 call assert_equal(['{', "\tif (i == 1)", "\t\tj = 2;", '}'], getline(3, '$')) |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
616 |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
617 %d |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
618 call setline(1, ['when while', '{', '']) |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
619 setlocal cinkeys+==while |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
620 exe "normal Giwh\<C-P> " |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
621 call assert_equal("\twhile ", getline('$')) |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
622 close! |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
623 endfunc |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
624 |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
625 " Test for <CTRL-X> <CTRL-V> completion. Complete commands and functions |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
626 func Test_complete_cmdline() |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
627 new |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
628 exe "normal icaddb\<C-X>\<C-V>" |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
629 call assert_equal('caddbuffer', getline(1)) |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
630 exe "normal ocall getqf\<C-X>\<C-V>" |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
631 call assert_equal('call getqflist(', getline(2)) |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
632 exe "normal oabcxyz(\<C-X>\<C-V>" |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
633 call assert_equal('abcxyz(', getline(3)) |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
634 close! |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
635 endfunc |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
636 |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
637 " vim: shiftwidth=2 sts=2 expandtab |