summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_ins_complete.vim
diff options
context:
space:
mode:
Diffstat (limited to 'src/testdir/test_ins_complete.vim')
-rw-r--r--src/testdir/test_ins_complete.vim24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim
index 52306e8..eb89a15 100644
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -1130,7 +1130,7 @@ func Test_complete_wholeline_unlistedbuf()
edit Xfile1
enew
set complete=U
- " completing from a unloaded buffer should fail
+ " completing from an unloaded buffer should fail
exe "normal! ia\<C-X>\<C-L>\<C-P>"
call assert_equal('a', getline(1))
%d
@@ -2429,4 +2429,26 @@ func Test_complete_changed_complete_info()
call StopVimInTerminal(buf)
endfunc
+func Test_completefunc_first_call_complete_add()
+ new
+
+ func Complete(findstart, base) abort
+ if a:findstart
+ let col = col('.')
+ call complete_add('#')
+ return col - 1
+ else
+ return []
+ endif
+ endfunc
+
+ set completeopt=longest completefunc=Complete
+ " This used to cause heap-buffer-overflow
+ call assert_fails('call feedkeys("ifoo#\<C-X>\<C-U>", "xt")', 'E840:')
+
+ delfunc Complete
+ set completeopt& completefunc&
+ bwipe!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab nofoldenable