Mercurial > vim
comparison src/testdir/test_ins_complete.vim @ 25372:c63a2d24b7e2 v8.2.3223
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Commit: https://github.com/vim/vim/commit/ff34bee3a2d22f2ff7abd4519270b5518082c33d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jul 25 20:27:06 2021 +0200
patch 8.2.3223: Vim: using {} block in autoloade omnifunc fails
Problem: Vim: using {} block in autoloade omnifunc fails.
Solution: Allow using {} block when text is locked. (closes https://github.com/vim/vim/issues/8631)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 25 Jul 2021 20:30:04 +0200 |
parents | f5225486d3de |
children | 31db9c6df4e3 |
comparison
equal
deleted
inserted
replaced
25371:e14bafcbce5c | 25372:c63a2d24b7e2 |
---|---|
119 bwipe! | 119 bwipe! |
120 delfunc Omni | 120 delfunc Omni |
121 set omnifunc= | 121 set omnifunc= |
122 endfunc | 122 endfunc |
123 | 123 |
124 func Test_omni_autoload() | |
125 let save_rtp = &rtp | |
126 set rtp=Xruntime/some | |
127 let dir = 'Xruntime/some/autoload' | |
128 call mkdir(dir, 'p') | |
129 | |
130 let lines =<< trim END | |
131 vim9script | |
132 def omni#func(findstart: bool, base: string): any | |
133 if findstart | |
134 return 1 | |
135 else | |
136 return ['match'] | |
137 endif | |
138 enddef | |
139 { | |
140 eval 1 + 2 | |
141 } | |
142 END | |
143 call writefile(lines, dir .. '/omni.vim') | |
144 | |
145 new | |
146 setlocal omnifunc=omni#func | |
147 call feedkeys("i\<C-X>\<C-O>\<Esc>", 'xt') | |
148 | |
149 bwipe! | |
150 call delete('Xruntime', 'rf') | |
151 set omnifunc= | |
152 let &rtp = save_rtp | |
153 endfunc | |
154 | |
124 func Test_completefunc_args() | 155 func Test_completefunc_args() |
125 let s:args = [] | 156 let s:args = [] |
126 func! CompleteFunc(findstart, base) | 157 func! CompleteFunc(findstart, base) |
127 let s:args += [[a:findstart, empty(a:base)]] | 158 let s:args += [[a:findstart, empty(a:base)]] |
128 endfunc | 159 endfunc |