0
0
mirror of https://github.com/vim/vim.git synced 2025-10-28 09:27:14 -04:00

patch 9.1.1610: completion: hang or E684 when 'tagfunc' calls complete()

Problem:  completion: hang (after 9.1.1471) or E684 (after 9.1.1410)
          when 'tagfunc' calls complete().
Solution: Check if complete() has been called immediately after getting
          matches instead of in the next loop iteration (zeertzjq).

related: #1668
related: neovim/neovim#34416
related: neovim/neovim#35163
closes: #17929

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2025-08-08 16:03:43 +02:00
committed by Christian Brabandt
parent bc51ec53d0
commit 982cda6976
3 changed files with 36 additions and 5 deletions

View File

@@ -3221,6 +3221,35 @@ func Test_tagfunc_wipes_out_buffer()
bwipe!
endfunc
func s:TagfuncComplete(t,f,o)
call complete(1, ['ddd', 'eee', 'fff'])
return []
endfunc
" 'tagfunc' calling complete() should not cause hang or E684.
func Test_tagfunc_calls_complete()
new
call setline(1, ['aaa', 'bbb', 'ccc'])
setlocal tagfunc=s:TagfuncComplete
setlocal completeopt=menu,noselect
let v:errmsg = ''
" This used to hang.
setlocal complete=.,t
call feedkeys("Go\<C-N>\<C-E>\<Esc>", 'tx')
call assert_equal('', getline('.'))
call assert_equal('', v:errmsg)
" This used to cause E684.
setlocal complete=t,.
call feedkeys("cc\<C-N>\<C-E>\<Esc>", 'tx')
call assert_equal('', getline('.'))
call assert_equal('', v:errmsg)
bwipe!
endfunc
func Test_ins_complete_popup_position()
CheckScreendump