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: #17511
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim
index 33c87cb..155c5b7 100644
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -4754,4 +4754,28 @@
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
+ 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