Mercurial > vim
annotate src/testdir/test_ins_complete.vim @ 26452:65b4109a4297 v8.2.3756
patch 8.2.3756: might crash when callback is not valid
Commit: https://github.com/vim/vim/commit/4dc24eb5adbcc76838fae1e900936dd230209d96
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Tue Dec 7 12:23:57 2021 +0000
patch 8.2.3756: might crash when callback is not valid
Problem: might crash when callback is not valid.
Solution: Check for valid callback. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/9293)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 07 Dec 2021 13:30:05 +0100 |
parents | 65ab0b035dd8 |
children | 7eaf61a67d18 |
rev | line source |
---|---|
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
20285
diff
changeset
|
1 " Test for insert completion |
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
20285
diff
changeset
|
2 |
18892
fb2d26bc8ca1
patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
3 source screendump.vim |
17588
1348696d07cd
patch 8.1.1791: 'completeslash' also applies to globpath()
Bram Moolenaar <Bram@vim.org>
parents:
17553
diff
changeset
|
4 source check.vim |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
5 source vim9.vim |
12686
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 " Test for insert expansion |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 func Test_ins_complete() |
12692
03a6aeea2096
patch 8.0.1224: still interference between test functions
Christian Brabandt <cb@256bit.org>
parents:
12686
diff
changeset
|
9 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
|
10 " 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
|
11 " 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
|
12 call mkdir('Xdir') |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12728
diff
changeset
|
13 cd Xdir |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12728
diff
changeset
|
14 |
12686
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 set ff=unix |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 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
|
17 \ "asd\ttest11file\t36G", |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 \ "Makefile\tto\trun"], 'Xtestfile') |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 call writefile(['', 'start of testfile', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 \ 'ru', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 \ 'run1', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 \ 'run2', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 \ 'STARTTEST', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 \ 'ENDTEST', |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 \ 'end of testfile'], 'Xtestdata') |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 set ff& |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 enew! |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 edit Xtestdata |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 new |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 call append(0, ['#include "Xtestfile"', '']) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 call cursor(2, 1) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 set cot= |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 set cpt=.,w |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 " 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
|
37 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
|
38 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
|
39 " add-expands (current buffer first) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 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
|
41 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
|
42 " 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
|
43 " 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-P>\<C-P>\<C-P>" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 call assert_equal('', getline('.')) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 " 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
|
47 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
|
48 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
|
49 |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 set cpt=.,w,i |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 " 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
|
52 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
|
53 call assert_equal("Makefile\tto\trun3", getline('.')) |
26211
485c7c4afeb7
patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents:
26195
diff
changeset
|
54 " add-expands lines (it would end in an empty line if it didn't ignore |
12686
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 " itself) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 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
|
57 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
|
58 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
|
59 |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 set cpt=kXtestfile |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 " 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
|
62 " 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
|
63 write Xtest11.one |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 write Xtest11.two |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 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
|
66 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
|
67 |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 " 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
|
69 " 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
|
70 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
|
71 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
|
72 normal ddk |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 set cpt=w |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 " 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
|
76 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
|
77 call assert_equal('STARTTEST', getline('.')) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 set cpt=u nohid |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 " checks unloaded buffer expansion |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 only |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 exe "normal oEN\<C-N>" |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
83 call assert_equal('ENDTEST', getline('.')) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
84 " checks adding mode abortion |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
85 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
|
86 call assert_equal('unless', getline('.')) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 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
|
89 " 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
|
90 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
|
91 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
|
92 " t-expansion |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
93 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
|
94 call assert_equal('asd', getline('.')) |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
95 |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
96 %bw! |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
97 call delete('Xtestfile') |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
98 call delete('Xtest11.one') |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
99 call delete('Xtest11.two') |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
100 call delete('Xtestdata') |
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
101 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
|
102 cd .. |
cb9b2774f21f
patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12728
diff
changeset
|
103 call delete('Xdir', 'rf') |
12686
aa658b33f25a
patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
104 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
|
105 |
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 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
|
107 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
|
108 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
|
109 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
|
110 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
|
111 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
|
112 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
|
113 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
|
114 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
|
115 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
|
116 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
|
117 exe "normal Gofind -\<C-x>\<C-o>" |
23169
5e6855ebc4ea
patch 8.2.2130: Insert mode completion messages end up in message history
Bram Moolenaar <Bram@vim.org>
parents:
22717
diff
changeset
|
118 call assert_equal("find -help", getline('$')) |
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
|
119 |
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 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
|
121 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
|
122 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
|
123 endfunc |
13215
ae5f855a64be
patch 8.0.1482: using feedkeys() does not work to test completion
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
124 |
25372
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
125 func Test_omni_autoload() |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
126 let save_rtp = &rtp |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
127 set rtp=Xruntime/some |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
128 let dir = 'Xruntime/some/autoload' |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
129 call mkdir(dir, 'p') |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
130 |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
131 let lines =<< trim END |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
132 vim9script |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
133 def omni#func(findstart: bool, base: string): any |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
134 if findstart |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
135 return 1 |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
136 else |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
137 return ['match'] |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
138 endif |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
139 enddef |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
140 { |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
141 eval 1 + 2 |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
142 } |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
143 END |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
144 call writefile(lines, dir .. '/omni.vim') |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
145 |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
146 new |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
147 setlocal omnifunc=omni#func |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
148 call feedkeys("i\<C-X>\<C-O>\<Esc>", 'xt') |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
149 |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
150 bwipe! |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
151 call delete('Xruntime', 'rf') |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
152 set omnifunc= |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
153 let &rtp = save_rtp |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
154 endfunc |
c63a2d24b7e2
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Bram Moolenaar <Bram@vim.org>
parents:
23772
diff
changeset
|
155 |
14071
c1fcfafa8d1a
patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents:
13238
diff
changeset
|
156 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
|
157 let s:args = [] |
c1fcfafa8d1a
patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents:
13238
diff
changeset
|
158 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
|
159 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
|
160 endfunc |
c1fcfafa8d1a
patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents:
13238
diff
changeset
|
161 new |
c1fcfafa8d1a
patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents:
13238
diff
changeset
|
162 |
c1fcfafa8d1a
patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents:
13238
diff
changeset
|
163 set completefunc=CompleteFunc |
c1fcfafa8d1a
patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents:
13238
diff
changeset
|
164 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
|
165 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
|
166 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
|
167 set completefunc= |
c1fcfafa8d1a
patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents:
13238
diff
changeset
|
168 |
c1fcfafa8d1a
patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents:
13238
diff
changeset
|
169 let s:args = [] |
c1fcfafa8d1a
patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents:
13238
diff
changeset
|
170 set omnifunc=CompleteFunc |
c1fcfafa8d1a
patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents:
13238
diff
changeset
|
171 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
|
172 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
|
173 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
|
174 set omnifunc= |
c1fcfafa8d1a
patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents:
13238
diff
changeset
|
175 |
c1fcfafa8d1a
patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents:
13238
diff
changeset
|
176 bwipe! |
c1fcfafa8d1a
patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents:
13238
diff
changeset
|
177 unlet s:args |
c1fcfafa8d1a
patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents:
13238
diff
changeset
|
178 delfunc CompleteFunc |
c1fcfafa8d1a
patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents:
13238
diff
changeset
|
179 endfunc |
c1fcfafa8d1a
patch 8.1.0053: first argument of 'completefunc' has inconsistent type
Christian Brabandt <cb@256bit.org>
parents:
13238
diff
changeset
|
180 |
15416
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
181 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
|
182 if a:findstart |
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
183 return 0 |
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
184 endif |
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
185 |
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
186 return v:none |
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
187 endfunc |
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
188 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14489
diff
changeset
|
189 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
|
190 if a:findstart |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
191 return 0 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
192 endif |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
193 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
194 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
|
195 \ 'words': [ |
a3fce2763e83
patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents:
18900
diff
changeset
|
196 \ { |
a3fce2763e83
patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents:
18900
diff
changeset
|
197 \ '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
|
198 \ '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
|
199 \ '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
|
200 \ '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
|
201 \ '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
|
202 \ '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
|
203 \ } |
a3fce2763e83
patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents:
18900
diff
changeset
|
204 \ ] |
a3fce2763e83
patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents:
18900
diff
changeset
|
205 \ } |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14489
diff
changeset
|
206 endfunc |
13238
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
207 |
15416
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
208 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
|
209 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
|
210 endfunc |
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
211 |
19199
8cbadf7fb9d4
patch 8.2.0158: triggering CompleteDone earlier is not backwards compatible
Bram Moolenaar <Bram@vim.org>
parents:
19127
diff
changeset
|
212 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
|
213 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
|
214 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
|
215 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
|
216 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
|
217 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
|
218 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
|
219 |
19199
8cbadf7fb9d4
patch 8.2.0158: triggering CompleteDone earlier is not backwards compatible
Bram Moolenaar <Bram@vim.org>
parents:
19127
diff
changeset
|
220 if a:pre |
8cbadf7fb9d4
patch 8.2.0158: triggering CompleteDone earlier is not backwards compatible
Bram Moolenaar <Bram@vim.org>
parents:
19127
diff
changeset
|
221 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
|
222 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
|
223 |
13238
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
224 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
|
225 endfunc |
13238
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
226 |
15416
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
227 func Test_CompleteDoneNone() |
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
228 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
|
229 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
|
230 |
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
231 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
|
232 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
|
233 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
|
234 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
|
235 |
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
236 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
|
237 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
|
238 |
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
239 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
|
240 au! CompleteDone |
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
241 endfunc |
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
242 |
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
243 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
|
244 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
|
245 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
|
246 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
247 set completefunc=<SID>CompleteDone_CompleteFuncDict |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
248 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
|
249 set completefunc& |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
250 |
15416
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
251 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
|
252 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
|
253 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
254 let s:called_completedone = 0 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
255 au! CompleteDone |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
256 endfunc |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
257 |
15416
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
258 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
|
259 if a:findstart |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
260 return 0 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
261 endif |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
262 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
263 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
|
264 \ 'words': [ |
a3fce2763e83
patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents:
18900
diff
changeset
|
265 \ { |
a3fce2763e83
patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents:
18900
diff
changeset
|
266 \ '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
|
267 \ '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
|
268 \ '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
|
269 \ '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
|
270 \ '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
|
271 \ '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
|
272 \ } |
a3fce2763e83
patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents:
18900
diff
changeset
|
273 \ ] |
a3fce2763e83
patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents:
18900
diff
changeset
|
274 \ } |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14489
diff
changeset
|
275 endfunc |
13238
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
276 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14489
diff
changeset
|
277 func s:CompleteDone_CheckCompletedItemDictNoUserData() |
13238
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
278 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
|
279 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
|
280 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
|
281 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
|
282 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
|
283 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
|
284 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
285 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
|
286 endfunc |
13238
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
287 |
15416
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
288 func Test_CompleteDoneDictNoUserData() |
13238
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
289 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
|
290 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
291 set completefunc=<SID>CompleteDone_CompleteFuncDictNoUserData |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
292 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
|
293 set completefunc& |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
294 |
19047
a3fce2763e83
patch 8.2.0084: complete item "user_data" can only be a string
Bram Moolenaar <Bram@vim.org>
parents:
18900
diff
changeset
|
295 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
|
296 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
|
297 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
298 let s:called_completedone = 0 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
299 au! CompleteDone |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
300 endfunc |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
301 |
15416
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
302 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
|
303 if a:findstart |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
304 return 0 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
305 endif |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
306 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
307 return [ 'aword' ] |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14489
diff
changeset
|
308 endfunc |
13238
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
309 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
14489
diff
changeset
|
310 func s:CompleteDone_CheckCompletedItemList() |
13238
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
311 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
|
312 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
|
313 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
|
314 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
|
315 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
|
316 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
|
317 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
318 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
|
319 endfunc |
13238
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
320 |
15416
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
321 func Test_CompleteDoneList() |
13238
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
322 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
|
323 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
324 set completefunc=<SID>CompleteDone_CompleteFuncList |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
325 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
|
326 set completefunc& |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
327 |
15416
5f8ddd2a7b92
patch 8.1.0716: get warning message when 'completefunc' returns nothing
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
328 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
|
329 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
|
330 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
331 let s:called_completedone = 0 |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
332 au! CompleteDone |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
333 endfunc |
e0dcfd3dbb52
patch 8.0.1493: completion items cannot be annotated
Christian Brabandt <cb@256bit.org>
parents:
13215
diff
changeset
|
334 |
14489
cda216729f9b
patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents:
14075
diff
changeset
|
335 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
|
336 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
|
337 new |
cda216729f9b
patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents:
14075
diff
changeset
|
338 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
|
339 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
|
340 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
|
341 \ getline(1, '$')) |
cda216729f9b
patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents:
14075
diff
changeset
|
342 undo |
cda216729f9b
patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents:
14075
diff
changeset
|
343 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
|
344 bwipe! |
cda216729f9b
patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents:
14075
diff
changeset
|
345 au! CompleteDone |
cda216729f9b
patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents:
14075
diff
changeset
|
346 endfunc |
cda216729f9b
patch 8.1.0258: not enough testing for the CompleteDone event
Christian Brabandt <cb@256bit.org>
parents:
14075
diff
changeset
|
347 |
22248
80a000b09cb0
patch 8.2.1673: complete_info() selected index has an invalid value
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
348 func CompleteTest(findstart, query) |
80a000b09cb0
patch 8.2.1673: complete_info() selected index has an invalid value
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
349 if a:findstart |
80a000b09cb0
patch 8.2.1673: complete_info() selected index has an invalid value
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
350 return col('.') |
80a000b09cb0
patch 8.2.1673: complete_info() selected index has an invalid value
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
351 endif |
80a000b09cb0
patch 8.2.1673: complete_info() selected index has an invalid value
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
352 return ['matched'] |
80a000b09cb0
patch 8.2.1673: complete_info() selected index has an invalid value
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
353 endfunc |
80a000b09cb0
patch 8.2.1673: complete_info() selected index has an invalid value
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
354 |
80a000b09cb0
patch 8.2.1673: complete_info() selected index has an invalid value
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
355 func Test_completefunc_info() |
80a000b09cb0
patch 8.2.1673: complete_info() selected index has an invalid value
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
356 new |
80a000b09cb0
patch 8.2.1673: complete_info() selected index has an invalid value
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
357 set completeopt=menuone |
80a000b09cb0
patch 8.2.1673: complete_info() selected index has an invalid value
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
358 set completefunc=CompleteTest |
80a000b09cb0
patch 8.2.1673: complete_info() selected index has an invalid value
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
359 call feedkeys("i\<C-X>\<C-U>\<C-R>\<C-R>=string(complete_info())\<CR>\<ESC>", "tx") |
22717
bd61aaf7f2a0
patch 8.2.1907: complete_info().selected may be wrong
Bram Moolenaar <Bram@vim.org>
parents:
22705
diff
changeset
|
360 call assert_equal("matched{'pum_visible': 1, 'mode': 'function', 'selected': 0, 'items': [{'word': 'matched', 'menu': '', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''}]}", getline(1)) |
22248
80a000b09cb0
patch 8.2.1673: complete_info() selected index has an invalid value
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
361 bwipe! |
80a000b09cb0
patch 8.2.1673: complete_info() selected index has an invalid value
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
362 set completeopt& |
80a000b09cb0
patch 8.2.1673: complete_info() selected index has an invalid value
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
363 set completefunc& |
80a000b09cb0
patch 8.2.1673: complete_info() selected index has an invalid value
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
364 endfunc |
80a000b09cb0
patch 8.2.1673: complete_info() selected index has an invalid value
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
365 |
13215
ae5f855a64be
patch 8.0.1482: using feedkeys() does not work to test completion
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
366 " 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
|
367 " completions. |
ae5f855a64be
patch 8.0.1482: using feedkeys() does not work to test completion
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
368 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
|
369 new |
ae5f855a64be
patch 8.0.1482: using feedkeys() does not work to test completion
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
370 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
|
371 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
|
372 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
|
373 bwipe! |
ae5f855a64be
patch 8.0.1482: using feedkeys() does not work to test completion
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
374 set completeopt& |
ae5f855a64be
patch 8.0.1482: using feedkeys() does not work to test completion
Christian Brabandt <cb@256bit.org>
parents:
12788
diff
changeset
|
375 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
|
376 |
26195
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
377 func s:ComplInCmdwin_GlobalCompletion(a, l, p) |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
378 return 'global' |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
379 endfunc |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
380 |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
381 func s:ComplInCmdwin_LocalCompletion(a, l, p) |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
382 return 'local' |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
383 endfunc |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
384 |
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
|
385 func Test_compl_in_cmdwin() |
23748
93f90f2ff4e9
patch 8.2.2415: no way to check for the cmdwin feature
Bram Moolenaar <Bram@vim.org>
parents:
23169
diff
changeset
|
386 CheckFeature cmdwin |
93f90f2ff4e9
patch 8.2.2415: no way to check for the cmdwin feature
Bram Moolenaar <Bram@vim.org>
parents:
23169
diff
changeset
|
387 |
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
|
388 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
|
389 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
|
390 com! -buffer TestCommand echo 'TestCommand' |
22705
ba3f547dc490
patch 8.2.1901: variable completion does not work in command line window
Bram Moolenaar <Bram@vim.org>
parents:
22427
diff
changeset
|
391 let w:test_winvar = 'winvar' |
ba3f547dc490
patch 8.2.1901: variable completion does not work in command line window
Bram Moolenaar <Bram@vim.org>
parents:
22427
diff
changeset
|
392 let b:test_bufvar = 'bufvar' |
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
|
393 |
22705
ba3f547dc490
patch 8.2.1901: variable completion does not work in command line window
Bram Moolenaar <Bram@vim.org>
parents:
22427
diff
changeset
|
394 " User-defined commands |
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
|
395 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
|
396 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
|
397 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
|
398 |
fa6c9047ec70
patch 8.1.1732: completion in cmdwin does not work for buffer-local commands
Bram Moolenaar <Bram@vim.org>
parents:
16270
diff
changeset
|
399 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
|
400 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
|
401 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
|
402 |
22705
ba3f547dc490
patch 8.2.1901: variable completion does not work in command line window
Bram Moolenaar <Bram@vim.org>
parents:
22427
diff
changeset
|
403 |
ba3f547dc490
patch 8.2.1901: variable completion does not work in command line window
Bram Moolenaar <Bram@vim.org>
parents:
22427
diff
changeset
|
404 com! -nargs=1 -complete=var GetInput let input = <q-args> |
ba3f547dc490
patch 8.2.1901: variable completion does not work in command line window
Bram Moolenaar <Bram@vim.org>
parents:
22427
diff
changeset
|
405 " Window-local variables |
ba3f547dc490
patch 8.2.1901: variable completion does not work in command line window
Bram Moolenaar <Bram@vim.org>
parents:
22427
diff
changeset
|
406 let input = '' |
ba3f547dc490
patch 8.2.1901: variable completion does not work in command line window
Bram Moolenaar <Bram@vim.org>
parents:
22427
diff
changeset
|
407 call feedkeys("q:iGetInput w:test_\<C-x>\<C-v>\<CR>", 'tx!') |
ba3f547dc490
patch 8.2.1901: variable completion does not work in command line window
Bram Moolenaar <Bram@vim.org>
parents:
22427
diff
changeset
|
408 call assert_equal('w:test_winvar', input) |
ba3f547dc490
patch 8.2.1901: variable completion does not work in command line window
Bram Moolenaar <Bram@vim.org>
parents:
22427
diff
changeset
|
409 |
ba3f547dc490
patch 8.2.1901: variable completion does not work in command line window
Bram Moolenaar <Bram@vim.org>
parents:
22427
diff
changeset
|
410 let input = '' |
ba3f547dc490
patch 8.2.1901: variable completion does not work in command line window
Bram Moolenaar <Bram@vim.org>
parents:
22427
diff
changeset
|
411 call feedkeys("q::GetInput w:test_\<Tab>\<CR>:q\<CR>", 'tx!') |
ba3f547dc490
patch 8.2.1901: variable completion does not work in command line window
Bram Moolenaar <Bram@vim.org>
parents:
22427
diff
changeset
|
412 call assert_equal('w:test_', input) |
ba3f547dc490
patch 8.2.1901: variable completion does not work in command line window
Bram Moolenaar <Bram@vim.org>
parents:
22427
diff
changeset
|
413 |
ba3f547dc490
patch 8.2.1901: variable completion does not work in command line window
Bram Moolenaar <Bram@vim.org>
parents:
22427
diff
changeset
|
414 " Buffer-local variables |
ba3f547dc490
patch 8.2.1901: variable completion does not work in command line window
Bram Moolenaar <Bram@vim.org>
parents:
22427
diff
changeset
|
415 let input = '' |
ba3f547dc490
patch 8.2.1901: variable completion does not work in command line window
Bram Moolenaar <Bram@vim.org>
parents:
22427
diff
changeset
|
416 call feedkeys("q:iGetInput b:test_\<C-x>\<C-v>\<CR>", 'tx!') |
ba3f547dc490
patch 8.2.1901: variable completion does not work in command line window
Bram Moolenaar <Bram@vim.org>
parents:
22427
diff
changeset
|
417 call assert_equal('b:test_bufvar', input) |
ba3f547dc490
patch 8.2.1901: variable completion does not work in command line window
Bram Moolenaar <Bram@vim.org>
parents:
22427
diff
changeset
|
418 |
ba3f547dc490
patch 8.2.1901: variable completion does not work in command line window
Bram Moolenaar <Bram@vim.org>
parents:
22427
diff
changeset
|
419 let input = '' |
ba3f547dc490
patch 8.2.1901: variable completion does not work in command line window
Bram Moolenaar <Bram@vim.org>
parents:
22427
diff
changeset
|
420 call feedkeys("q::GetInput b:test_\<Tab>\<CR>:q\<CR>", 'tx!') |
ba3f547dc490
patch 8.2.1901: variable completion does not work in command line window
Bram Moolenaar <Bram@vim.org>
parents:
22427
diff
changeset
|
421 call assert_equal('b:test_', input) |
ba3f547dc490
patch 8.2.1901: variable completion does not work in command line window
Bram Moolenaar <Bram@vim.org>
parents:
22427
diff
changeset
|
422 |
26195
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
423 |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
424 " Argument completion of buffer-local command |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
425 func s:ComplInCmdwin_GlobalCompletionList(a, l, p) |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
426 return ['global'] |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
427 endfunc |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
428 |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
429 func s:ComplInCmdwin_LocalCompletionList(a, l, p) |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
430 return ['local'] |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
431 endfunc |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
432 |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
433 func s:ComplInCmdwin_CheckCompletion(arg) |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
434 call assert_equal('local', a:arg) |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
435 endfunc |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
436 |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
437 com! -nargs=1 -complete=custom,<SID>ComplInCmdwin_GlobalCompletion |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
438 \ TestCommand call s:ComplInCmdwin_CheckCompletion(<q-args>) |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
439 com! -buffer -nargs=1 -complete=custom,<SID>ComplInCmdwin_LocalCompletion |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
440 \ TestCommand call s:ComplInCmdwin_CheckCompletion(<q-args>) |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
441 call feedkeys("q:iTestCommand \<Tab>\<CR>", 'tx!') |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
442 |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
443 com! -nargs=1 -complete=customlist,<SID>ComplInCmdwin_GlobalCompletionList |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
444 \ TestCommand call s:ComplInCmdwin_CheckCompletion(<q-args>) |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
445 com! -buffer -nargs=1 -complete=customlist,<SID>ComplInCmdwin_LocalCompletionList |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
446 \ TestCommand call s:ComplInCmdwin_CheckCompletion(<q-args>) |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
447 |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
448 call feedkeys("q:iTestCommand \<Tab>\<CR>", 'tx!') |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
449 |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
450 func! s:ComplInCmdwin_CheckCompletion(arg) |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
451 call assert_equal('global', a:arg) |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
452 endfunc |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
453 new |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
454 call feedkeys("q:iTestCommand \<Tab>\<CR>", 'tx!') |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
455 quit |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
456 |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
457 delfunc s:ComplInCmdwin_GlobalCompletion |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
458 delfunc s:ComplInCmdwin_LocalCompletion |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
459 delfunc s:ComplInCmdwin_GlobalCompletionList |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
460 delfunc s:ComplInCmdwin_LocalCompletionList |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
461 delfunc s:ComplInCmdwin_CheckCompletion |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
462 |
41b3718d84c3
patch 8.2.3629: command completion in cmdline window uses global commands
Bram Moolenaar <Bram@vim.org>
parents:
25707
diff
changeset
|
463 delcom -buffer TestCommand |
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
|
464 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
|
465 delcom GetInput |
22705
ba3f547dc490
patch 8.2.1901: variable completion does not work in command line window
Bram Moolenaar <Bram@vim.org>
parents:
22427
diff
changeset
|
466 unlet w:test_winvar |
ba3f547dc490
patch 8.2.1901: variable completion does not work in command line window
Bram Moolenaar <Bram@vim.org>
parents:
22427
diff
changeset
|
467 unlet b:test_bufvar |
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
|
468 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
|
469 endfunc |
17543
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
470 |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
471 " 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
|
472 func Test_ins_completeslash() |
17588
1348696d07cd
patch 8.1.1791: 'completeslash' also applies to globpath()
Bram Moolenaar <Bram@vim.org>
parents:
17553
diff
changeset
|
473 CheckMSWindows |
22397
0a5770061295
patch 8.2.1747: result of expand() unexpectedly depends on 'completeslash'
Bram Moolenaar <Bram@vim.org>
parents:
22248
diff
changeset
|
474 |
17543
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
475 call mkdir('Xdir') |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
476 let orig_shellslash = &shellslash |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
477 set cpt& |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
478 new |
22397
0a5770061295
patch 8.2.1747: result of expand() unexpectedly depends on 'completeslash'
Bram Moolenaar <Bram@vim.org>
parents:
22248
diff
changeset
|
479 |
17543
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
480 set noshellslash |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
481 |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
482 set completeslash= |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
483 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
|
484 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
|
485 |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
486 set completeslash=backslash |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
487 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
|
488 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
|
489 |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
490 set completeslash=slash |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
491 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
|
492 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
|
493 |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
494 set shellslash |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
495 |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
496 set completeslash= |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
497 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
|
498 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
|
499 |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
500 set completeslash=backslash |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
501 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
|
502 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
|
503 |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
504 set completeslash=slash |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
505 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
|
506 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
|
507 %bw! |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
508 call delete('Xdir', 'rf') |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
509 |
17588
1348696d07cd
patch 8.1.1791: 'completeslash' also applies to globpath()
Bram Moolenaar <Bram@vim.org>
parents:
17553
diff
changeset
|
510 set noshellslash |
1348696d07cd
patch 8.1.1791: 'completeslash' also applies to globpath()
Bram Moolenaar <Bram@vim.org>
parents:
17553
diff
changeset
|
511 set completeslash=slash |
1348696d07cd
patch 8.1.1791: 'completeslash' also applies to globpath()
Bram Moolenaar <Bram@vim.org>
parents:
17553
diff
changeset
|
512 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
|
513 |
17543
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
514 let &shellslash = orig_shellslash |
17588
1348696d07cd
patch 8.1.1791: 'completeslash' also applies to globpath()
Bram Moolenaar <Bram@vim.org>
parents:
17553
diff
changeset
|
515 set completeslash= |
17543
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
516 endfunc |
77c3f6428b6c
patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents:
17468
diff
changeset
|
517 |
22427
58cdc5d7f143
patch 8.2.1762: when a timer uses :stopinsert completion isn't stopped
Bram Moolenaar <Bram@vim.org>
parents:
22397
diff
changeset
|
518 func Test_pum_stopped_by_timer() |
58cdc5d7f143
patch 8.2.1762: when a timer uses :stopinsert completion isn't stopped
Bram Moolenaar <Bram@vim.org>
parents:
22397
diff
changeset
|
519 CheckScreendump |
58cdc5d7f143
patch 8.2.1762: when a timer uses :stopinsert completion isn't stopped
Bram Moolenaar <Bram@vim.org>
parents:
22397
diff
changeset
|
520 |
58cdc5d7f143
patch 8.2.1762: when a timer uses :stopinsert completion isn't stopped
Bram Moolenaar <Bram@vim.org>
parents:
22397
diff
changeset
|
521 let lines =<< trim END |
58cdc5d7f143
patch 8.2.1762: when a timer uses :stopinsert completion isn't stopped
Bram Moolenaar <Bram@vim.org>
parents:
22397
diff
changeset
|
522 call setline(1, ['hello', 'hullo', 'heeee', '']) |
58cdc5d7f143
patch 8.2.1762: when a timer uses :stopinsert completion isn't stopped
Bram Moolenaar <Bram@vim.org>
parents:
22397
diff
changeset
|
523 func StartCompl() |
58cdc5d7f143
patch 8.2.1762: when a timer uses :stopinsert completion isn't stopped
Bram Moolenaar <Bram@vim.org>
parents:
22397
diff
changeset
|
524 call timer_start(100, { -> execute('stopinsert') }) |
58cdc5d7f143
patch 8.2.1762: when a timer uses :stopinsert completion isn't stopped
Bram Moolenaar <Bram@vim.org>
parents:
22397
diff
changeset
|
525 call feedkeys("Gah\<C-N>") |
58cdc5d7f143
patch 8.2.1762: when a timer uses :stopinsert completion isn't stopped
Bram Moolenaar <Bram@vim.org>
parents:
22397
diff
changeset
|
526 endfunc |
58cdc5d7f143
patch 8.2.1762: when a timer uses :stopinsert completion isn't stopped
Bram Moolenaar <Bram@vim.org>
parents:
22397
diff
changeset
|
527 END |
58cdc5d7f143
patch 8.2.1762: when a timer uses :stopinsert completion isn't stopped
Bram Moolenaar <Bram@vim.org>
parents:
22397
diff
changeset
|
528 |
58cdc5d7f143
patch 8.2.1762: when a timer uses :stopinsert completion isn't stopped
Bram Moolenaar <Bram@vim.org>
parents:
22397
diff
changeset
|
529 call writefile(lines, 'Xpumscript') |
58cdc5d7f143
patch 8.2.1762: when a timer uses :stopinsert completion isn't stopped
Bram Moolenaar <Bram@vim.org>
parents:
22397
diff
changeset
|
530 let buf = RunVimInTerminal('-S Xpumscript', #{rows: 12}) |
58cdc5d7f143
patch 8.2.1762: when a timer uses :stopinsert completion isn't stopped
Bram Moolenaar <Bram@vim.org>
parents:
22397
diff
changeset
|
531 call term_sendkeys(buf, ":call StartCompl()\<CR>") |
58cdc5d7f143
patch 8.2.1762: when a timer uses :stopinsert completion isn't stopped
Bram Moolenaar <Bram@vim.org>
parents:
22397
diff
changeset
|
532 call TermWait(buf, 200) |
58cdc5d7f143
patch 8.2.1762: when a timer uses :stopinsert completion isn't stopped
Bram Moolenaar <Bram@vim.org>
parents:
22397
diff
changeset
|
533 call term_sendkeys(buf, "k") |
58cdc5d7f143
patch 8.2.1762: when a timer uses :stopinsert completion isn't stopped
Bram Moolenaar <Bram@vim.org>
parents:
22397
diff
changeset
|
534 call VerifyScreenDump(buf, 'Test_pum_stopped_by_timer', {}) |
58cdc5d7f143
patch 8.2.1762: when a timer uses :stopinsert completion isn't stopped
Bram Moolenaar <Bram@vim.org>
parents:
22397
diff
changeset
|
535 |
58cdc5d7f143
patch 8.2.1762: when a timer uses :stopinsert completion isn't stopped
Bram Moolenaar <Bram@vim.org>
parents:
22397
diff
changeset
|
536 call StopVimInTerminal(buf) |
58cdc5d7f143
patch 8.2.1762: when a timer uses :stopinsert completion isn't stopped
Bram Moolenaar <Bram@vim.org>
parents:
22397
diff
changeset
|
537 call delete('Xpumscript') |
58cdc5d7f143
patch 8.2.1762: when a timer uses :stopinsert completion isn't stopped
Bram Moolenaar <Bram@vim.org>
parents:
22397
diff
changeset
|
538 endfunc |
58cdc5d7f143
patch 8.2.1762: when a timer uses :stopinsert completion isn't stopped
Bram Moolenaar <Bram@vim.org>
parents:
22397
diff
changeset
|
539 |
18892
fb2d26bc8ca1
patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
540 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
|
541 CheckScreendump |
fb2d26bc8ca1
patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
542 |
fb2d26bc8ca1
patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
543 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
|
544 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
|
545 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
|
546 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
|
547 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
|
548 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
|
549 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
|
550 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
|
551 END |
fb2d26bc8ca1
patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
552 |
fb2d26bc8ca1
patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
553 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
|
554 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
|
555 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
|
556 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
|
557 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
|
558 |
fb2d26bc8ca1
patch 8.2.0007: popup menu positioned wrong with folding in two tabs
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
559 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
|
560 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
|
561 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
|
562 endfunc |
18900
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
563 |
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
564 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
|
565 CheckScreendump |
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
566 |
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
567 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
|
568 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
|
569 if a:findstart |
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
570 return col(".") - 1 |
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
571 endif |
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
572 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
|
573 endfunc |
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
574 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
|
575 set completeopt+=longest |
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
576 END |
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
577 |
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
578 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
|
579 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
|
580 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
|
581 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
|
582 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
|
583 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
|
584 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
|
585 |
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
586 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
|
587 call StopVimInTerminal(buf) |
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
588 call delete('Xpreviewscript') |
a9c47c623f4a
patch 8.2.0011: screen updating wrong when opeing preview window
Bram Moolenaar <Bram@vim.org>
parents:
18892
diff
changeset
|
589 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
|
590 |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
591 " 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
|
592 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
|
593 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
|
594 \ "!_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
|
595 \ "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
|
596 \ "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
|
597 \ "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
|
598 \ '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
|
599 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
|
600 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
|
601 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
|
602 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
|
603 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
|
604 [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
|
605 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
|
606 |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
607 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
|
608 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
|
609 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
|
610 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
|
611 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
|
612 |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
19047
diff
changeset
|
613 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
|
614 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
|
615 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
|
616 %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
|
617 endfunc |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
618 |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
619 " 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
|
620 func Test_completefunc_error() |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
621 new |
20120
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
622 " 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
|
623 func CompleteFunc(findstart, base) |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
624 if a:findstart == 1 |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
625 normal dd |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
626 return col('.') - 1 |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
627 endif |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
628 return ['a', 'b'] |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
629 endfunc |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
630 set completefunc=CompleteFunc |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
631 call setline(1, ['', 'abcd', '']) |
23772
f5225486d3de
patch 8.2.2427: can still switch windows for 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents:
23770
diff
changeset
|
632 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
|
633 |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
634 " 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
|
635 func CompleteFunc2(findstart, base) |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
636 if a:findstart == 1 |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
637 return col('.') - 1 |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
638 endif |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
639 normal dd |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
640 return ['a', 'b'] |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
641 endfunc |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
642 set completefunc=CompleteFunc2 |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
643 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
|
644 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
|
645 |
23766
704fdd4d0949
patch 8.2.2424: some tests are known to cause an error with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
23748
diff
changeset
|
646 " Jump to a different window from the complete function |
23770
385d33dfb7df
patch 8.2.2426: allowing 'completefunc' to switch windows causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
23766
diff
changeset
|
647 func CompleteFunc3(findstart, base) |
23766
704fdd4d0949
patch 8.2.2424: some tests are known to cause an error with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
23748
diff
changeset
|
648 if a:findstart == 1 |
704fdd4d0949
patch 8.2.2424: some tests are known to cause an error with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
23748
diff
changeset
|
649 return col('.') - 1 |
704fdd4d0949
patch 8.2.2424: some tests are known to cause an error with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
23748
diff
changeset
|
650 endif |
704fdd4d0949
patch 8.2.2424: some tests are known to cause an error with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
23748
diff
changeset
|
651 wincmd p |
704fdd4d0949
patch 8.2.2424: some tests are known to cause an error with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
23748
diff
changeset
|
652 return ['a', 'b'] |
704fdd4d0949
patch 8.2.2424: some tests are known to cause an error with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
23748
diff
changeset
|
653 endfunc |
23770
385d33dfb7df
patch 8.2.2426: allowing 'completefunc' to switch windows causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
23766
diff
changeset
|
654 set completefunc=CompleteFunc3 |
23766
704fdd4d0949
patch 8.2.2424: some tests are known to cause an error with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
23748
diff
changeset
|
655 new |
23770
385d33dfb7df
patch 8.2.2426: allowing 'completefunc' to switch windows causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
23766
diff
changeset
|
656 call assert_fails('exe "normal a\<C-X>\<C-U>"', 'E565:') |
23766
704fdd4d0949
patch 8.2.2424: some tests are known to cause an error with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
23748
diff
changeset
|
657 close! |
704fdd4d0949
patch 8.2.2424: some tests are known to cause an error with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
23748
diff
changeset
|
658 |
704fdd4d0949
patch 8.2.2424: some tests are known to cause an error with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
23748
diff
changeset
|
659 set completefunc& |
704fdd4d0949
patch 8.2.2424: some tests are known to cause an error with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
23748
diff
changeset
|
660 delfunc CompleteFunc |
23770
385d33dfb7df
patch 8.2.2426: allowing 'completefunc' to switch windows causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
23766
diff
changeset
|
661 delfunc CompleteFunc2 |
385d33dfb7df
patch 8.2.2426: allowing 'completefunc' to switch windows causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
23766
diff
changeset
|
662 delfunc CompleteFunc3 |
385d33dfb7df
patch 8.2.2426: allowing 'completefunc' to switch windows causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
23766
diff
changeset
|
663 close! |
23766
704fdd4d0949
patch 8.2.2424: some tests are known to cause an error with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
23748
diff
changeset
|
664 endfunc |
704fdd4d0949
patch 8.2.2424: some tests are known to cause an error with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
23748
diff
changeset
|
665 |
20285
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
666 " 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
|
667 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
|
668 new |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
669 func! CompleteFunc(findstart, base) |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
670 if a:findstart == 1 |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
671 return col('.') - 1 |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
672 endif |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
673 return [{}, '', 'moon'] |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
674 endfunc |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
675 set completefunc=CompleteFunc |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
676 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
|
677 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
|
678 set completefunc& |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
679 close! |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
680 endfunc |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
681 |
20120
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
682 " 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
|
683 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
|
684 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
|
685 func ListColors() |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
686 call complete(col('.'), "blue") |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
687 endfunc |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
688 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
|
689 func ListMonths() |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
690 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
|
691 endfunc |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
692 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
|
693 delfunc ListColors |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
694 delfunc ListMonths |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
695 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
|
696 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
|
697 endfunc |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
698 |
20199
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
699 " 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
|
700 func Test_complete_wrapscan() |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
701 " complete words from another buffer |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
702 new |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
703 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
|
704 new |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
705 setlocal complete=w |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
706 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
|
707 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
|
708 close! |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
709 " 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
|
710 setlocal complete=. |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
711 %d |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
712 call setline(1, ['one two', '']) |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
713 call cursor(2, 1) |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
714 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
|
715 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
|
716 close! |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
717 endfunc |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
718 |
20285
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
719 " 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
|
720 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
|
721 new |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
722 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
|
723 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
|
724 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
|
725 close! |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
726 endfunc |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
727 |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
728 " 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
|
729 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
|
730 new |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
731 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
|
732 setlocal textwidth=20 |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
733 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
|
734 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
|
735 close! |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
736 endfunc |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
737 |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
738 " 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
|
739 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
|
740 new |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
741 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
|
742 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
|
743 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
|
744 |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
745 " 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
|
746 " 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
|
747 %d |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
748 set ignorecase backspace=2 |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
749 setlocal complete=. |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
750 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
|
751 normal Go |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
752 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
|
753 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
|
754 set ignorecase& backspace& |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
755 close! |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
756 endfunc |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
757 |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
758 " 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
|
759 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
|
760 new |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
761 setlocal cindent |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
762 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
|
763 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
|
764 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
|
765 |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
766 %d |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
767 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
|
768 setlocal cinkeys+==while |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
769 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
|
770 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
|
771 close! |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
772 endfunc |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
773 |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
774 " 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
|
775 func Test_complete_cmdline() |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
776 new |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
777 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
|
778 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
|
779 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
|
780 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
|
781 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
|
782 call assert_equal('abcxyz(', getline(3)) |
25707
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
783 com! -buffer TestCommand1 echo 'TestCommand1' |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
784 com! -buffer TestCommand2 echo 'TestCommand2' |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
785 write TestCommand1Test |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
786 write TestCommand2Test |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
787 " Test repeating <CTRL-X> <CTRL-V> and switching to another CTRL-X mode |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
788 exe "normal oT\<C-X>\<C-V>\<C-X>\<C-V>\<C-X>\<C-F>\<Esc>" |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
789 call assert_equal('TestCommand2Test', getline(4)) |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
790 call delete('TestCommand1Test') |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
791 call delete('TestCommand2Test') |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
792 delcom TestCommand1 |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
793 delcom TestCommand2 |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
794 close! |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
795 endfunc |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
796 |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
797 " Test for <CTRL-X> <CTRL-Z> stopping completion without changing the match |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
798 func Test_complete_stop() |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
799 new |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
800 func Save_mode1() |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
801 let g:mode1 = mode(1) |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
802 return '' |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
803 endfunc |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
804 func Save_mode2() |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
805 let g:mode2 = mode(1) |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
806 return '' |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
807 endfunc |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
808 inoremap <F1> <C-R>=Save_mode1()<CR> |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
809 inoremap <F2> <C-R>=Save_mode2()<CR> |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
810 call setline(1, ['aaa bbb ccc ']) |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
811 exe "normal A\<C-N>\<C-P>\<F1>\<C-X>\<C-Z>\<F2>\<Esc>" |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
812 call assert_equal('ic', g:mode1) |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
813 call assert_equal('i', g:mode2) |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
814 call assert_equal('aaa bbb ccc ', getline(1)) |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
815 exe "normal A\<C-N>\<Down>\<F1>\<C-X>\<C-Z>\<F2>\<Esc>" |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
816 call assert_equal('ic', g:mode1) |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
817 call assert_equal('i', g:mode2) |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
818 call assert_equal('aaa bbb ccc aaa', getline(1)) |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
819 set completeopt+=noselect |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
820 exe "normal A \<C-N>\<Down>\<Down>\<C-L>\<C-L>\<F1>\<C-X>\<C-Z>\<F2>\<Esc>" |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
821 call assert_equal('ic', g:mode1) |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
822 call assert_equal('i', g:mode2) |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
823 call assert_equal('aaa bbb ccc aaa bb', getline(1)) |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
824 set completeopt& |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
825 exe "normal A d\<C-N>\<F1>\<C-X>\<C-Z>\<F2>\<Esc>" |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
826 call assert_equal('ic', g:mode1) |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
827 call assert_equal('i', g:mode2) |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
828 call assert_equal('aaa bbb ccc aaa bb d', getline(1)) |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
829 com! -buffer TestCommand1 echo 'TestCommand1' |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
830 com! -buffer TestCommand2 echo 'TestCommand2' |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
831 exe "normal oT\<C-X>\<C-V>\<C-X>\<C-V>\<F1>\<C-X>\<C-Z>\<F2>\<Esc>" |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
832 call assert_equal('ic', g:mode1) |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
833 call assert_equal('i', g:mode2) |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
834 call assert_equal('TestCommand2', getline(2)) |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
835 delcom TestCommand1 |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
836 delcom TestCommand2 |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
837 unlet g:mode1 |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
838 unlet g:mode2 |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
839 iunmap <F1> |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
840 iunmap <F2> |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
841 delfunc Save_mode1 |
31db9c6df4e3
patch 8.2.3389: cannot stop insert mode completion without side effects
Bram Moolenaar <Bram@vim.org>
parents:
25372
diff
changeset
|
842 delfunc Save_mode2 |
20285
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
843 close! |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
844 endfunc |
bce10d039e06
patch 8.2.0698: insert mode completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
20229
diff
changeset
|
845 |
22397
0a5770061295
patch 8.2.1747: result of expand() unexpectedly depends on 'completeslash'
Bram Moolenaar <Bram@vim.org>
parents:
22248
diff
changeset
|
846 func Test_issue_7021() |
0a5770061295
patch 8.2.1747: result of expand() unexpectedly depends on 'completeslash'
Bram Moolenaar <Bram@vim.org>
parents:
22248
diff
changeset
|
847 CheckMSWindows |
0a5770061295
patch 8.2.1747: result of expand() unexpectedly depends on 'completeslash'
Bram Moolenaar <Bram@vim.org>
parents:
22248
diff
changeset
|
848 |
0a5770061295
patch 8.2.1747: result of expand() unexpectedly depends on 'completeslash'
Bram Moolenaar <Bram@vim.org>
parents:
22248
diff
changeset
|
849 let orig_shellslash = &shellslash |
0a5770061295
patch 8.2.1747: result of expand() unexpectedly depends on 'completeslash'
Bram Moolenaar <Bram@vim.org>
parents:
22248
diff
changeset
|
850 set noshellslash |
0a5770061295
patch 8.2.1747: result of expand() unexpectedly depends on 'completeslash'
Bram Moolenaar <Bram@vim.org>
parents:
22248
diff
changeset
|
851 |
0a5770061295
patch 8.2.1747: result of expand() unexpectedly depends on 'completeslash'
Bram Moolenaar <Bram@vim.org>
parents:
22248
diff
changeset
|
852 set completeslash=slash |
0a5770061295
patch 8.2.1747: result of expand() unexpectedly depends on 'completeslash'
Bram Moolenaar <Bram@vim.org>
parents:
22248
diff
changeset
|
853 call assert_false(expand('~') =~ '/') |
0a5770061295
patch 8.2.1747: result of expand() unexpectedly depends on 'completeslash'
Bram Moolenaar <Bram@vim.org>
parents:
22248
diff
changeset
|
854 |
0a5770061295
patch 8.2.1747: result of expand() unexpectedly depends on 'completeslash'
Bram Moolenaar <Bram@vim.org>
parents:
22248
diff
changeset
|
855 let &shellslash = orig_shellslash |
0a5770061295
patch 8.2.1747: result of expand() unexpectedly depends on 'completeslash'
Bram Moolenaar <Bram@vim.org>
parents:
22248
diff
changeset
|
856 set completeslash= |
0a5770061295
patch 8.2.1747: result of expand() unexpectedly depends on 'completeslash'
Bram Moolenaar <Bram@vim.org>
parents:
22248
diff
changeset
|
857 endfunc |
0a5770061295
patch 8.2.1747: result of expand() unexpectedly depends on 'completeslash'
Bram Moolenaar <Bram@vim.org>
parents:
22248
diff
changeset
|
858 |
23169
5e6855ebc4ea
patch 8.2.2130: Insert mode completion messages end up in message history
Bram Moolenaar <Bram@vim.org>
parents:
22717
diff
changeset
|
859 " Test to ensure 'Scanning...' messages are not recorded in messages history |
5e6855ebc4ea
patch 8.2.2130: Insert mode completion messages end up in message history
Bram Moolenaar <Bram@vim.org>
parents:
22717
diff
changeset
|
860 func Test_z1_complete_no_history() |
5e6855ebc4ea
patch 8.2.2130: Insert mode completion messages end up in message history
Bram Moolenaar <Bram@vim.org>
parents:
22717
diff
changeset
|
861 new |
5e6855ebc4ea
patch 8.2.2130: Insert mode completion messages end up in message history
Bram Moolenaar <Bram@vim.org>
parents:
22717
diff
changeset
|
862 messages clear |
5e6855ebc4ea
patch 8.2.2130: Insert mode completion messages end up in message history
Bram Moolenaar <Bram@vim.org>
parents:
22717
diff
changeset
|
863 let currmess = execute('messages') |
5e6855ebc4ea
patch 8.2.2130: Insert mode completion messages end up in message history
Bram Moolenaar <Bram@vim.org>
parents:
22717
diff
changeset
|
864 setlocal dictionary=README.txt |
5e6855ebc4ea
patch 8.2.2130: Insert mode completion messages end up in message history
Bram Moolenaar <Bram@vim.org>
parents:
22717
diff
changeset
|
865 exe "normal owh\<C-X>\<C-K>" |
5e6855ebc4ea
patch 8.2.2130: Insert mode completion messages end up in message history
Bram Moolenaar <Bram@vim.org>
parents:
22717
diff
changeset
|
866 exe "normal owh\<C-N>" |
5e6855ebc4ea
patch 8.2.2130: Insert mode completion messages end up in message history
Bram Moolenaar <Bram@vim.org>
parents:
22717
diff
changeset
|
867 call assert_equal(currmess, execute('messages')) |
5e6855ebc4ea
patch 8.2.2130: Insert mode completion messages end up in message history
Bram Moolenaar <Bram@vim.org>
parents:
22717
diff
changeset
|
868 close! |
5e6855ebc4ea
patch 8.2.2130: Insert mode completion messages end up in message history
Bram Moolenaar <Bram@vim.org>
parents:
22717
diff
changeset
|
869 endfunc |
5e6855ebc4ea
patch 8.2.2130: Insert mode completion messages end up in message history
Bram Moolenaar <Bram@vim.org>
parents:
22717
diff
changeset
|
870 |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
871 " Test for different ways of setting the 'completefunc' option |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
872 func Test_completefunc_callback() |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
873 " Test for using a function() |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
874 func MycompleteFunc1(findstart, base) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
875 call add(g:MycompleteFunc1_args, [a:findstart, a:base]) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
876 return a:findstart ? 0 : [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
877 endfunc |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
878 set completefunc=function('MycompleteFunc1') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
879 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
880 call setline(1, 'one') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
881 let g:MycompleteFunc1_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
882 call feedkeys("A\<C-X>\<C-U>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
883 call assert_equal([[1, ''], [0, 'one']], g:MycompleteFunc1_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
884 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
885 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
886 " Using a funcref variable to set 'completefunc' |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
887 let Fn = function('MycompleteFunc1') |
26441
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
888 let &completefunc = Fn |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
889 new | only |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
890 call setline(1, 'two') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
891 let g:MycompleteFunc1_args = [] |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
892 call feedkeys("A\<C-X>\<C-U>\<Esc>", 'x') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
893 call assert_equal([[1, ''], [0, 'two']], g:MycompleteFunc1_args) |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
894 bw! |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
895 |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
896 " Using string(funcref_variable) to set 'completefunc' |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
897 let Fn = function('MycompleteFunc1') |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
898 let &completefunc = string(Fn) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
899 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
900 call setline(1, 'two') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
901 let g:MycompleteFunc1_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
902 call feedkeys("A\<C-X>\<C-U>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
903 call assert_equal([[1, ''], [0, 'two']], g:MycompleteFunc1_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
904 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
905 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
906 " Test for using a funcref() |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
907 func MycompleteFunc2(findstart, base) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
908 call add(g:MycompleteFunc2_args, [a:findstart, a:base]) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
909 return a:findstart ? 0 : [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
910 endfunc |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
911 set completefunc=funcref('MycompleteFunc2') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
912 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
913 call setline(1, 'three') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
914 let g:MycompleteFunc2_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
915 call feedkeys("A\<C-X>\<C-U>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
916 call assert_equal([[1, ''], [0, 'three']], g:MycompleteFunc2_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
917 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
918 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
919 " Using a funcref variable to set 'completefunc' |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
920 let Fn = funcref('MycompleteFunc2') |
26441
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
921 let &completefunc = Fn |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
922 new | only |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
923 call setline(1, 'four') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
924 let g:MycompleteFunc2_args = [] |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
925 call feedkeys("A\<C-X>\<C-U>\<Esc>", 'x') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
926 call assert_equal([[1, ''], [0, 'four']], g:MycompleteFunc2_args) |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
927 bw! |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
928 |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
929 " Using a string(funcref_variable) to set 'completefunc' |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
930 let Fn = funcref('MycompleteFunc2') |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
931 let &completefunc = string(Fn) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
932 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
933 call setline(1, 'four') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
934 let g:MycompleteFunc2_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
935 call feedkeys("A\<C-X>\<C-U>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
936 call assert_equal([[1, ''], [0, 'four']], g:MycompleteFunc2_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
937 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
938 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
939 " Test for using a lambda function |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
940 func MycompleteFunc3(findstart, base) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
941 call add(g:MycompleteFunc3_args, [a:findstart, a:base]) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
942 return a:findstart ? 0 : [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
943 endfunc |
26408
8f17f8f327f3
patch 8.2.3735: cannot use a lambda for 'imactivatefunc'
Bram Moolenaar <Bram@vim.org>
parents:
26388
diff
changeset
|
944 set completefunc={a,\ b\ ->\ MycompleteFunc3(a,\ b)} |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
945 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
946 call setline(1, 'five') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
947 let g:MycompleteFunc3_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
948 call feedkeys("A\<C-X>\<C-U>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
949 call assert_equal([[1, ''], [0, 'five']], g:MycompleteFunc3_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
950 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
951 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
952 " Set 'completefunc' to a lambda expression |
26441
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
953 let &completefunc = {a, b -> MycompleteFunc3(a, b)} |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
954 new | only |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
955 call setline(1, 'six') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
956 let g:MycompleteFunc3_args = [] |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
957 call feedkeys("A\<C-X>\<C-U>\<Esc>", 'x') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
958 call assert_equal([[1, ''], [0, 'six']], g:MycompleteFunc3_args) |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
959 bw! |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
960 |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
961 " Set 'completefunc' to string(lambda_expression) |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
962 let &completefunc = '{a, b -> MycompleteFunc3(a, b)}' |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
963 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
964 call setline(1, 'six') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
965 let g:MycompleteFunc3_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
966 call feedkeys("A\<C-X>\<C-U>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
967 call assert_equal([[1, ''], [0, 'six']], g:MycompleteFunc3_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
968 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
969 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
970 " Set 'completefunc' to a variable with a lambda expression |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
971 let Lambda = {a, b -> MycompleteFunc3(a, b)} |
26441
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
972 let &completefunc = Lambda |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
973 new | only |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
974 call setline(1, 'seven') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
975 let g:MycompleteFunc3_args = [] |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
976 call feedkeys("A\<C-X>\<C-U>\<Esc>", 'x') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
977 call assert_equal([[1, ''], [0, 'seven']], g:MycompleteFunc3_args) |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
978 bw! |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
979 |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
980 " Set 'completefunc' to a string(variable with a lambda expression) |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
981 let Lambda = {a, b -> MycompleteFunc3(a, b)} |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
982 let &completefunc = string(Lambda) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
983 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
984 call setline(1, 'seven') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
985 let g:MycompleteFunc3_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
986 call feedkeys("A\<C-X>\<C-U>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
987 call assert_equal([[1, ''], [0, 'seven']], g:MycompleteFunc3_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
988 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
989 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
990 " Test for using a lambda function with incorrect return value |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
991 let Lambda = {s -> strlen(s)} |
26441
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
992 let &completefunc = Lambda |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
993 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
994 call setline(1, 'eight') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
995 call feedkeys("A\<C-X>\<C-U>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
996 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
997 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
998 " Test for clearing the 'completefunc' option |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
999 set completefunc='' |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1000 set completefunc& |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1001 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1002 call assert_fails("set completefunc=function('abc')", "E700:") |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1003 call assert_fails("set completefunc=funcref('abc')", "E700:") |
26441
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1004 let &completefunc = {a -> 'abc'} |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1005 call feedkeys("A\<C-X>\<C-U>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1006 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1007 " Vim9 tests |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1008 let lines =<< trim END |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1009 vim9script |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1010 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1011 # Test for using function() |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1012 def MycompleteFunc1(findstart: number, base: string): any |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1013 add(g:MycompleteFunc1_args, [findstart, base]) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1014 return findstart ? 0 : [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1015 enddef |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1016 set completefunc=function('MycompleteFunc1') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1017 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1018 setline(1, 'one') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1019 g:MycompleteFunc1_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1020 feedkeys("A\<C-X>\<C-U>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1021 assert_equal([[1, ''], [0, 'one']], g:MycompleteFunc1_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1022 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1023 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1024 # Test for using a lambda |
26408
8f17f8f327f3
patch 8.2.3735: cannot use a lambda for 'imactivatefunc'
Bram Moolenaar <Bram@vim.org>
parents:
26388
diff
changeset
|
1025 def LambdaComplete1(findstart: number, base: string): any |
8f17f8f327f3
patch 8.2.3735: cannot use a lambda for 'imactivatefunc'
Bram Moolenaar <Bram@vim.org>
parents:
26388
diff
changeset
|
1026 add(g:LambdaComplete1_args, [findstart, base]) |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1027 return findstart ? 0 : [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1028 enddef |
26441
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1029 &completefunc = (a, b) => LambdaComplete1(a, b) |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1030 new | only |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1031 setline(1, 'two') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1032 g:LambdaComplete1_args = [] |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1033 feedkeys("A\<C-X>\<C-U>\<Esc>", 'x') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1034 assert_equal([[1, ''], [0, 'two']], g:LambdaComplete1_args) |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1035 bw! |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1036 |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1037 # Test for using a string(lambda) |
26408
8f17f8f327f3
patch 8.2.3735: cannot use a lambda for 'imactivatefunc'
Bram Moolenaar <Bram@vim.org>
parents:
26388
diff
changeset
|
1038 &completefunc = '(a, b) => LambdaComplete1(a, b)' |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1039 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1040 setline(1, 'two') |
26408
8f17f8f327f3
patch 8.2.3735: cannot use a lambda for 'imactivatefunc'
Bram Moolenaar <Bram@vim.org>
parents:
26388
diff
changeset
|
1041 g:LambdaComplete1_args = [] |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1042 feedkeys("A\<C-X>\<C-U>\<Esc>", 'x') |
26408
8f17f8f327f3
patch 8.2.3735: cannot use a lambda for 'imactivatefunc'
Bram Moolenaar <Bram@vim.org>
parents:
26388
diff
changeset
|
1043 assert_equal([[1, ''], [0, 'two']], g:LambdaComplete1_args) |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1044 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1045 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1046 # Test for using a variable with a lambda expression |
26408
8f17f8f327f3
patch 8.2.3735: cannot use a lambda for 'imactivatefunc'
Bram Moolenaar <Bram@vim.org>
parents:
26388
diff
changeset
|
1047 var Fn: func = (findstart, base) => { |
8f17f8f327f3
patch 8.2.3735: cannot use a lambda for 'imactivatefunc'
Bram Moolenaar <Bram@vim.org>
parents:
26388
diff
changeset
|
1048 add(g:LambdaComplete2_args, [findstart, base]) |
8f17f8f327f3
patch 8.2.3735: cannot use a lambda for 'imactivatefunc'
Bram Moolenaar <Bram@vim.org>
parents:
26388
diff
changeset
|
1049 return findstart ? 0 : [] |
8f17f8f327f3
patch 8.2.3735: cannot use a lambda for 'imactivatefunc'
Bram Moolenaar <Bram@vim.org>
parents:
26388
diff
changeset
|
1050 } |
26441
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1051 &completefunc = Fn |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1052 new | only |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1053 setline(1, 'three') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1054 g:LambdaComplete2_args = [] |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1055 feedkeys("A\<C-X>\<C-U>\<Esc>", 'x') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1056 assert_equal([[1, ''], [0, 'three']], g:LambdaComplete2_args) |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1057 bw! |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1058 |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1059 # Test for using a string(variable with a lambda expression) |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1060 &completefunc = string(Fn) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1061 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1062 setline(1, 'three') |
26408
8f17f8f327f3
patch 8.2.3735: cannot use a lambda for 'imactivatefunc'
Bram Moolenaar <Bram@vim.org>
parents:
26388
diff
changeset
|
1063 g:LambdaComplete2_args = [] |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1064 feedkeys("A\<C-X>\<C-U>\<Esc>", 'x') |
26408
8f17f8f327f3
patch 8.2.3735: cannot use a lambda for 'imactivatefunc'
Bram Moolenaar <Bram@vim.org>
parents:
26388
diff
changeset
|
1065 assert_equal([[1, ''], [0, 'three']], g:LambdaComplete2_args) |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1066 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1067 END |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1068 call CheckScriptSuccess(lines) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1069 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1070 " Using Vim9 lambda expression in legacy context should fail |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1071 set completefunc=(a,\ b)\ =>\ g:MycompleteFunc2(a,\ b) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1072 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1073 let g:MycompleteFunc2_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1074 call assert_fails('call feedkeys("A\<C-X>\<C-U>\<Esc>", "x")', 'E117:') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1075 call assert_equal([], g:MycompleteFunc2_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1076 |
26452
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1077 " set 'completefunc' to a non-existing function |
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1078 set completefunc=MycompleteFunc2 |
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1079 call setline(1, 'five') |
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1080 call assert_fails("set completefunc=function('NonExistingFunc')", 'E700:') |
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1081 call assert_fails("let &completefunc = function('NonExistingFunc')", 'E700:') |
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1082 let g:MycompleteFunc2_args = [] |
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1083 call feedkeys("A\<C-X>\<C-U>\<Esc>", 'x') |
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1084 call assert_equal([[1, ''], [0, 'five']], g:MycompleteFunc2_args) |
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1085 |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1086 " cleanup |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1087 delfunc MycompleteFunc1 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1088 delfunc MycompleteFunc2 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1089 delfunc MycompleteFunc3 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1090 set completefunc& |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1091 %bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1092 endfunc |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1093 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1094 " Test for different ways of setting the 'omnifunc' option |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1095 func Test_omnifunc_callback() |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1096 " Test for using a function() |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1097 func MyomniFunc1(findstart, base) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1098 call add(g:MyomniFunc1_args, [a:findstart, a:base]) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1099 return a:findstart ? 0 : [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1100 endfunc |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1101 set omnifunc=function('MyomniFunc1') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1102 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1103 call setline(1, 'one') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1104 let g:MyomniFunc1_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1105 call feedkeys("A\<C-X>\<C-O>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1106 call assert_equal([[1, ''], [0, 'one']], g:MyomniFunc1_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1107 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1108 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1109 " Using a funcref variable to set 'omnifunc' |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1110 let Fn = function('MyomniFunc1') |
26441
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1111 let &omnifunc = Fn |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1112 new | only |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1113 call setline(1, 'two') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1114 let g:MyomniFunc1_args = [] |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1115 call feedkeys("A\<C-X>\<C-O>\<Esc>", 'x') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1116 call assert_equal([[1, ''], [0, 'two']], g:MyomniFunc1_args) |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1117 bw! |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1118 |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1119 " Using a string(funcref_variable) to set 'omnifunc' |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1120 let Fn = function('MyomniFunc1') |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1121 let &omnifunc = string(Fn) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1122 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1123 call setline(1, 'two') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1124 let g:MyomniFunc1_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1125 call feedkeys("A\<C-X>\<C-O>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1126 call assert_equal([[1, ''], [0, 'two']], g:MyomniFunc1_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1127 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1128 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1129 " Test for using a funcref() |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1130 func MyomniFunc2(findstart, base) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1131 call add(g:MyomniFunc2_args, [a:findstart, a:base]) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1132 return a:findstart ? 0 : [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1133 endfunc |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1134 set omnifunc=funcref('MyomniFunc2') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1135 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1136 call setline(1, 'three') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1137 let g:MyomniFunc2_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1138 call feedkeys("A\<C-X>\<C-O>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1139 call assert_equal([[1, ''], [0, 'three']], g:MyomniFunc2_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1140 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1141 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1142 " Using a funcref variable to set 'omnifunc' |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1143 let Fn = funcref('MyomniFunc2') |
26441
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1144 let &omnifunc = Fn |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1145 new | only |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1146 call setline(1, 'four') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1147 let g:MyomniFunc2_args = [] |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1148 call feedkeys("A\<C-X>\<C-O>\<Esc>", 'x') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1149 call assert_equal([[1, ''], [0, 'four']], g:MyomniFunc2_args) |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1150 bw! |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1151 |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1152 " Using a string(funcref_variable) to set 'omnifunc' |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1153 let Fn = funcref('MyomniFunc2') |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1154 let &omnifunc = string(Fn) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1155 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1156 call setline(1, 'four') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1157 let g:MyomniFunc2_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1158 call feedkeys("A\<C-X>\<C-O>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1159 call assert_equal([[1, ''], [0, 'four']], g:MyomniFunc2_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1160 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1161 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1162 " Test for using a lambda function |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1163 func MyomniFunc3(findstart, base) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1164 call add(g:MyomniFunc3_args, [a:findstart, a:base]) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1165 return a:findstart ? 0 : [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1166 endfunc |
26408
8f17f8f327f3
patch 8.2.3735: cannot use a lambda for 'imactivatefunc'
Bram Moolenaar <Bram@vim.org>
parents:
26388
diff
changeset
|
1167 set omnifunc={a,\ b\ ->\ MyomniFunc3(a,\ b)} |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1168 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1169 call setline(1, 'five') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1170 let g:MyomniFunc3_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1171 call feedkeys("A\<C-X>\<C-O>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1172 call assert_equal([[1, ''], [0, 'five']], g:MyomniFunc3_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1173 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1174 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1175 " Set 'omnifunc' to a lambda expression |
26441
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1176 let &omnifunc = {a, b -> MyomniFunc3(a, b)} |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1177 new | only |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1178 call setline(1, 'six') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1179 let g:MyomniFunc3_args = [] |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1180 call feedkeys("A\<C-X>\<C-O>\<Esc>", 'x') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1181 call assert_equal([[1, ''], [0, 'six']], g:MyomniFunc3_args) |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1182 bw! |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1183 |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1184 " Set 'omnifunc' to a string(lambda_expression) |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1185 let &omnifunc = '{a, b -> MyomniFunc3(a, b)}' |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1186 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1187 call setline(1, 'six') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1188 let g:MyomniFunc3_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1189 call feedkeys("A\<C-X>\<C-O>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1190 call assert_equal([[1, ''], [0, 'six']], g:MyomniFunc3_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1191 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1192 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1193 " Set 'omnifunc' to a variable with a lambda expression |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1194 let Lambda = {a, b -> MyomniFunc3(a, b)} |
26441
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1195 let &omnifunc = Lambda |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1196 new | only |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1197 call setline(1, 'seven') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1198 let g:MyomniFunc3_args = [] |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1199 call feedkeys("A\<C-X>\<C-O>\<Esc>", 'x') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1200 call assert_equal([[1, ''], [0, 'seven']], g:MyomniFunc3_args) |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1201 bw! |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1202 |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1203 " Set 'omnifunc' to a string(variable with a lambda expression) |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1204 let Lambda = {a, b -> MyomniFunc3(a, b)} |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1205 let &omnifunc = string(Lambda) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1206 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1207 call setline(1, 'seven') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1208 let g:MyomniFunc3_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1209 call feedkeys("A\<C-X>\<C-O>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1210 call assert_equal([[1, ''], [0, 'seven']], g:MyomniFunc3_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1211 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1212 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1213 " Test for using a lambda function with incorrect return value |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1214 let Lambda = {s -> strlen(s)} |
26441
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1215 let &omnifunc = Lambda |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1216 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1217 call setline(1, 'eight') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1218 call feedkeys("A\<C-X>\<C-O>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1219 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1220 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1221 " Test for clearing the 'omnifunc' option |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1222 set omnifunc='' |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1223 set omnifunc& |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1224 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1225 call assert_fails("set omnifunc=function('abc')", "E700:") |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1226 call assert_fails("set omnifunc=funcref('abc')", "E700:") |
26441
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1227 let &omnifunc = {a -> 'abc'} |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1228 call feedkeys("A\<C-X>\<C-O>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1229 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1230 " Vim9 tests |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1231 let lines =<< trim END |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1232 vim9script |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1233 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1234 # Test for using function() |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1235 def MyomniFunc1(findstart: number, base: string): any |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1236 add(g:MyomniFunc1_args, [findstart, base]) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1237 return findstart ? 0 : [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1238 enddef |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1239 set omnifunc=function('MyomniFunc1') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1240 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1241 setline(1, 'one') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1242 g:MyomniFunc1_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1243 feedkeys("A\<C-X>\<C-O>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1244 assert_equal([[1, ''], [0, 'one']], g:MyomniFunc1_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1245 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1246 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1247 # Test for using a lambda |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1248 def MyomniFunc2(findstart: number, base: string): any |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1249 add(g:MyomniFunc2_args, [findstart, base]) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1250 return findstart ? 0 : [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1251 enddef |
26441
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1252 &omnifunc = (a, b) => MyomniFunc2(a, b) |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1253 new | only |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1254 setline(1, 'two') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1255 g:MyomniFunc2_args = [] |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1256 feedkeys("A\<C-X>\<C-O>\<Esc>", 'x') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1257 assert_equal([[1, ''], [0, 'two']], g:MyomniFunc2_args) |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1258 bw! |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1259 |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1260 # Test for using a string(lambda) |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1261 &omnifunc = '(a, b) => MyomniFunc2(a, b)' |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1262 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1263 setline(1, 'two') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1264 g:MyomniFunc2_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1265 feedkeys("A\<C-X>\<C-O>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1266 assert_equal([[1, ''], [0, 'two']], g:MyomniFunc2_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1267 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1268 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1269 # Test for using a variable with a lambda expression |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1270 var Fn: func = (a, b) => MyomniFunc2(a, b) |
26441
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1271 &omnifunc = Fn |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1272 new | only |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1273 setline(1, 'three') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1274 g:MyomniFunc2_args = [] |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1275 feedkeys("A\<C-X>\<C-O>\<Esc>", 'x') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1276 assert_equal([[1, ''], [0, 'three']], g:MyomniFunc2_args) |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1277 bw! |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1278 |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1279 # Test for using a string(variable with a lambda expression) |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1280 &omnifunc = string(Fn) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1281 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1282 setline(1, 'three') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1283 g:MyomniFunc2_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1284 feedkeys("A\<C-X>\<C-O>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1285 assert_equal([[1, ''], [0, 'three']], g:MyomniFunc2_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1286 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1287 END |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1288 call CheckScriptSuccess(lines) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1289 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1290 " Using Vim9 lambda expression in legacy context should fail |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1291 set omnifunc=(a,\ b)\ =>\ g:MyomniFunc2(a,\ b) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1292 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1293 let g:MyomniFunc2_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1294 call assert_fails('call feedkeys("A\<C-X>\<C-O>\<Esc>", "x")', 'E117:') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1295 call assert_equal([], g:MyomniFunc2_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1296 |
26452
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1297 " set 'omnifunc' to a non-existing function |
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1298 set omnifunc=MyomniFunc2 |
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1299 call setline(1, 'nine') |
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1300 call assert_fails("set omnifunc=function('NonExistingFunc')", 'E700:') |
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1301 call assert_fails("let &omnifunc = function('NonExistingFunc')", 'E700:') |
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1302 let g:MyomniFunc2_args = [] |
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1303 call feedkeys("A\<C-X>\<C-O>\<Esc>", 'x') |
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1304 call assert_equal([[1, ''], [0, 'nine']], g:MyomniFunc2_args) |
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1305 |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1306 " cleanup |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1307 delfunc MyomniFunc1 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1308 delfunc MyomniFunc2 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1309 delfunc MyomniFunc3 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1310 set omnifunc& |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1311 %bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1312 endfunc |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1313 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1314 " Test for different ways of setting the 'thesaurusfunc' option |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1315 func Test_thesaurusfunc_callback() |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1316 " Test for using a function() |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1317 func MytsrFunc1(findstart, base) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1318 call add(g:MytsrFunc1_args, [a:findstart, a:base]) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1319 return a:findstart ? 0 : [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1320 endfunc |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1321 set thesaurusfunc=function('MytsrFunc1') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1322 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1323 call setline(1, 'one') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1324 let g:MytsrFunc1_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1325 call feedkeys("A\<C-X>\<C-T>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1326 call assert_equal([[1, ''], [0, 'one']], g:MytsrFunc1_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1327 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1328 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1329 " Using a funcref variable to set 'thesaurusfunc' |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1330 let Fn = function('MytsrFunc1') |
26441
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1331 let &thesaurusfunc = Fn |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1332 new | only |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1333 call setline(1, 'two') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1334 let g:MytsrFunc1_args = [] |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1335 call feedkeys("A\<C-X>\<C-T>\<Esc>", 'x') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1336 call assert_equal([[1, ''], [0, 'two']], g:MytsrFunc1_args) |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1337 bw! |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1338 |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1339 " Using a string(funcref_variable) to set 'thesaurusfunc' |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1340 let Fn = function('MytsrFunc1') |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1341 let &thesaurusfunc = string(Fn) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1342 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1343 call setline(1, 'two') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1344 let g:MytsrFunc1_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1345 call feedkeys("A\<C-X>\<C-T>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1346 call assert_equal([[1, ''], [0, 'two']], g:MytsrFunc1_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1347 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1348 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1349 " Test for using a funcref() |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1350 func MytsrFunc2(findstart, base) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1351 call add(g:MytsrFunc2_args, [a:findstart, a:base]) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1352 return a:findstart ? 0 : [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1353 endfunc |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1354 set thesaurusfunc=funcref('MytsrFunc2') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1355 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1356 call setline(1, 'three') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1357 let g:MytsrFunc2_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1358 call feedkeys("A\<C-X>\<C-T>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1359 call assert_equal([[1, ''], [0, 'three']], g:MytsrFunc2_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1360 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1361 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1362 " Using a funcref variable to set 'thesaurusfunc' |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1363 let Fn = funcref('MytsrFunc2') |
26441
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1364 let &thesaurusfunc = Fn |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1365 new | only |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1366 call setline(1, 'four') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1367 let g:MytsrFunc2_args = [] |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1368 call feedkeys("A\<C-X>\<C-T>\<Esc>", 'x') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1369 call assert_equal([[1, ''], [0, 'four']], g:MytsrFunc2_args) |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1370 bw! |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1371 |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1372 " Using a string(funcref_variable) to set 'thesaurusfunc' |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1373 let Fn = funcref('MytsrFunc2') |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1374 let &thesaurusfunc = string(Fn) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1375 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1376 call setline(1, 'four') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1377 let g:MytsrFunc2_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1378 call feedkeys("A\<C-X>\<C-T>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1379 call assert_equal([[1, ''], [0, 'four']], g:MytsrFunc2_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1380 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1381 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1382 " Test for using a lambda function |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1383 func MytsrFunc3(findstart, base) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1384 call add(g:MytsrFunc3_args, [a:findstart, a:base]) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1385 return a:findstart ? 0 : [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1386 endfunc |
26408
8f17f8f327f3
patch 8.2.3735: cannot use a lambda for 'imactivatefunc'
Bram Moolenaar <Bram@vim.org>
parents:
26388
diff
changeset
|
1387 set thesaurusfunc={a,\ b\ ->\ MytsrFunc3(a,\ b)} |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1388 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1389 call setline(1, 'five') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1390 let g:MytsrFunc3_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1391 call feedkeys("A\<C-X>\<C-T>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1392 call assert_equal([[1, ''], [0, 'five']], g:MytsrFunc3_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1393 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1394 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1395 " Set 'thesaurusfunc' to a lambda expression |
26441
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1396 let &thesaurusfunc = {a, b -> MytsrFunc3(a, b)} |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1397 new | only |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1398 call setline(1, 'six') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1399 let g:MytsrFunc3_args = [] |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1400 call feedkeys("A\<C-X>\<C-T>\<Esc>", 'x') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1401 call assert_equal([[1, ''], [0, 'six']], g:MytsrFunc3_args) |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1402 bw! |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1403 |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1404 " Set 'thesaurusfunc' to a string(lambda expression) |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1405 let &thesaurusfunc = '{a, b -> MytsrFunc3(a, b)}' |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1406 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1407 call setline(1, 'six') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1408 let g:MytsrFunc3_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1409 call feedkeys("A\<C-X>\<C-T>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1410 call assert_equal([[1, ''], [0, 'six']], g:MytsrFunc3_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1411 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1412 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1413 " Set 'thesaurusfunc' to a variable with a lambda expression |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1414 let Lambda = {a, b -> MytsrFunc3(a, b)} |
26441
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1415 let &thesaurusfunc = Lambda |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1416 new | only |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1417 call setline(1, 'seven') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1418 let g:MytsrFunc3_args = [] |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1419 call feedkeys("A\<C-X>\<C-T>\<Esc>", 'x') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1420 call assert_equal([[1, ''], [0, 'seven']], g:MytsrFunc3_args) |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1421 bw! |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1422 |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1423 " Set 'thesaurusfunc' to a string(variable with a lambda expression) |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1424 let Lambda = {a, b -> MytsrFunc3(a, b)} |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1425 let &thesaurusfunc = string(Lambda) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1426 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1427 call setline(1, 'seven') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1428 let g:MytsrFunc3_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1429 call feedkeys("A\<C-X>\<C-T>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1430 call assert_equal([[1, ''], [0, 'seven']], g:MytsrFunc3_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1431 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1432 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1433 " Test for using a lambda function with incorrect return value |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1434 let Lambda = {s -> strlen(s)} |
26441
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1435 let &thesaurusfunc = Lambda |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1436 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1437 call setline(1, 'eight') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1438 call feedkeys("A\<C-X>\<C-T>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1439 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1440 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1441 " Test for clearing the 'thesaurusfunc' option |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1442 set thesaurusfunc='' |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1443 set thesaurusfunc& |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1444 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1445 call assert_fails("set thesaurusfunc=function('abc')", "E700:") |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1446 call assert_fails("set thesaurusfunc=funcref('abc')", "E700:") |
26441
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1447 let &thesaurusfunc = {a -> 'abc'} |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1448 call feedkeys("A\<C-X>\<C-T>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1449 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1450 " Vim9 tests |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1451 let lines =<< trim END |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1452 vim9script |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1453 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1454 # Test for using function() |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1455 def MytsrFunc1(findstart: number, base: string): any |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1456 add(g:MytsrFunc1_args, [findstart, base]) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1457 return findstart ? 0 : [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1458 enddef |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1459 set thesaurusfunc=function('MytsrFunc1') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1460 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1461 setline(1, 'one') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1462 g:MytsrFunc1_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1463 feedkeys("A\<C-X>\<C-T>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1464 assert_equal([[1, ''], [0, 'one']], g:MytsrFunc1_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1465 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1466 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1467 # Test for using a lambda |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1468 def MytsrFunc2(findstart: number, base: string): any |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1469 add(g:MytsrFunc2_args, [findstart, base]) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1470 return findstart ? 0 : [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1471 enddef |
26441
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1472 &thesaurusfunc = (a, b) => MytsrFunc2(a, b) |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1473 new | only |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1474 setline(1, 'two') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1475 g:MytsrFunc2_args = [] |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1476 feedkeys("A\<C-X>\<C-T>\<Esc>", 'x') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1477 assert_equal([[1, ''], [0, 'two']], g:MytsrFunc2_args) |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1478 bw! |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1479 |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1480 # Test for using a string(lambda) |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1481 &thesaurusfunc = '(a, b) => MytsrFunc2(a, b)' |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1482 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1483 setline(1, 'two') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1484 g:MytsrFunc2_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1485 feedkeys("A\<C-X>\<C-T>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1486 assert_equal([[1, ''], [0, 'two']], g:MytsrFunc2_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1487 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1488 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1489 # Test for using a variable with a lambda expression |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1490 var Fn: func = (a, b) => MytsrFunc2(a, b) |
26441
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1491 &thesaurusfunc = Fn |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1492 new | only |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1493 setline(1, 'three') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1494 g:MytsrFunc2_args = [] |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1495 feedkeys("A\<C-X>\<C-T>\<Esc>", 'x') |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1496 assert_equal([[1, ''], [0, 'three']], g:MytsrFunc2_args) |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1497 bw! |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1498 |
65ab0b035dd8
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Bram Moolenaar <Bram@vim.org>
parents:
26408
diff
changeset
|
1499 # Test for using a string(variable with a lambda expression) |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1500 &thesaurusfunc = string(Fn) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1501 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1502 setline(1, 'three') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1503 g:MytsrFunc2_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1504 feedkeys("A\<C-X>\<C-T>\<Esc>", 'x') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1505 assert_equal([[1, ''], [0, 'three']], g:MytsrFunc2_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1506 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1507 END |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1508 call CheckScriptSuccess(lines) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1509 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1510 " Using Vim9 lambda expression in legacy context should fail |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1511 set thesaurusfunc=(a,\ b)\ =>\ g:MytsrFunc2(a,\ b) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1512 new | only |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1513 let g:MytsrFunc2_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1514 call assert_fails('call feedkeys("A\<C-X>\<C-T>\<Esc>", "x")', 'E117:') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1515 call assert_equal([], g:MytsrFunc2_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1516 bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1517 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1518 " Use a buffer-local value and a global value |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1519 func MytsrFunc4(findstart, base) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1520 call add(g:MytsrFunc4_args, [a:findstart, a:base]) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1521 return a:findstart ? 0 : ['sunday'] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1522 endfunc |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1523 set thesaurusfunc& |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1524 setlocal thesaurusfunc=function('MytsrFunc4') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1525 call setline(1, 'sun') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1526 let g:MytsrFunc4_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1527 call feedkeys("A\<C-X>\<C-T>\<Esc>", "x") |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1528 call assert_equal('sunday', getline(1)) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1529 call assert_equal([[1, ''], [0, 'sun']], g:MytsrFunc4_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1530 new |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1531 call setline(1, 'sun') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1532 let g:MytsrFunc4_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1533 call feedkeys("A\<C-X>\<C-T>\<Esc>", "x") |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1534 call assert_equal('sun', getline(1)) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1535 call assert_equal([], g:MytsrFunc4_args) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1536 set thesaurusfunc=function('MytsrFunc1') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1537 wincmd w |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1538 call setline(1, 'sun') |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1539 let g:MytsrFunc4_args = [] |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1540 call feedkeys("A\<C-X>\<C-T>\<Esc>", "x") |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1541 call assert_equal('sunday', getline(1)) |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1542 call assert_equal([[1, ''], [0, 'sun']], g:MytsrFunc4_args) |
26452
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1543 %bw! |
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1544 |
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1545 " set 'thesaurusfunc' to a non-existing function |
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1546 set thesaurusfunc=MytsrFunc2 |
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1547 call setline(1, 'ten') |
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1548 call assert_fails("set thesaurusfunc=function('NonExistingFunc')", 'E700:') |
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1549 call assert_fails("let &thesaurusfunc = function('NonExistingFunc')", 'E700:') |
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1550 let g:MytsrFunc2_args = [] |
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1551 call feedkeys("A\<C-X>\<C-T>\<Esc>", 'x') |
65b4109a4297
patch 8.2.3756: might crash when callback is not valid
Bram Moolenaar <Bram@vim.org>
parents:
26441
diff
changeset
|
1552 call assert_equal([[1, ''], [0, 'ten']], g:MytsrFunc2_args) |
26388
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1553 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1554 " cleanup |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1555 set thesaurusfunc& |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1556 delfunc MytsrFunc1 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1557 delfunc MytsrFunc2 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1558 delfunc MytsrFunc3 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1559 delfunc MytsrFunc4 |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1560 %bw! |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1561 endfunc |
8aba638e91eb
patch 8.2.3725: cannot use a lambda for 'completefunc' and 'omnifunc'
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
1562 |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
1563 " vim: shiftwidth=2 sts=2 expandtab |