mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
vim-patch:9.1.1447: completion: crash when backspacing with fuzzy completion
Problem: completion: crash when backspacing with fuzzy completion
Solution: Don't dereference compl_first_match when it's NULL
(zeertzjq).
related: neovim/neovim#34419
closes: vim/vim#17511
91782b4aeb
This commit is contained in:
@ -4835,4 +4835,29 @@ func Test_complete_unloaded_buf_refresh_always()
|
||||
delfunc TestComplete
|
||||
endfunc
|
||||
|
||||
func Test_complete_fuzzy_omnifunc_backspace()
|
||||
let g:do_complete = v:false
|
||||
func Omni_test(findstart, base)
|
||||
if a:findstart
|
||||
let g:do_complete = !g:do_complete
|
||||
endif
|
||||
if g:do_complete
|
||||
return a:findstart ? 0 : [#{word: a:base .. 'def'}, #{word: a:base .. 'ghi'}]
|
||||
endif
|
||||
return a:findstart ? -3 : {}
|
||||
endfunc
|
||||
|
||||
new
|
||||
redraw " need this to prevent NULL dereference in Nvim
|
||||
setlocal omnifunc=Omni_test
|
||||
setlocal completeopt=menuone,fuzzy,noinsert
|
||||
call setline(1, 'abc')
|
||||
call feedkeys("A\<C-X>\<C-O>\<BS>\<Esc>0", 'tx!')
|
||||
call assert_equal('ab', getline(1))
|
||||
|
||||
bwipe!
|
||||
delfunc Omni_test
|
||||
unlet g:do_complete
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab nofoldenable
|
||||
|
Reference in New Issue
Block a user