From ff34bee3a2d22f2ff7abd4519270b5518082c33d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 25 Jul 2021 20:27:06 +0200 Subject: [PATCH] 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 #8631) --- src/ex_cmds.h | 2 +- src/testdir/test_ins_complete.vim | 31 +++++++++++++++++++++++++++++++ src/version.c | 2 ++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/ex_cmds.h b/src/ex_cmds.h index ef3fa669c..8596b24b4 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -1853,7 +1853,7 @@ EXCMD(CMD_at, "@", ex_at, EX_RANGE|EX_WHOLEFOLD|EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK|EX_NONWHITE_OK, ADDR_LINES), EXCMD(CMD_block, "{", ex_block, // not found normally - EX_TRLBAR, + EX_TRLBAR|EX_LOCK_OK, ADDR_NONE), EXCMD(CMD_endblock, "}", ex_endblock, EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK, diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim index 613e9520d..1f2c7fe31 100644 --- a/src/testdir/test_ins_complete.vim +++ b/src/testdir/test_ins_complete.vim @@ -121,6 +121,37 @@ func Test_omni_dash() set omnifunc= endfunc +func Test_omni_autoload() + let save_rtp = &rtp + set rtp=Xruntime/some + let dir = 'Xruntime/some/autoload' + call mkdir(dir, 'p') + + let lines =<< trim END + vim9script + def omni#func(findstart: bool, base: string): any + if findstart + return 1 + else + return ['match'] + endif + enddef + { + eval 1 + 2 + } + END + call writefile(lines, dir .. '/omni.vim') + + new + setlocal omnifunc=omni#func + call feedkeys("i\\\", 'xt') + + bwipe! + call delete('Xruntime', 'rf') + set omnifunc= + let &rtp = save_rtp +endfunc + func Test_completefunc_args() let s:args = [] func! CompleteFunc(findstart, base) diff --git a/src/version.c b/src/version.c index f8a3ee478..0f181efdf 100644 --- a/src/version.c +++ b/src/version.c @@ -755,6 +755,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 3223, /**/ 3222, /**/ -- 2.40.0