From a80ec88906220b6527c553f7614180ba3bfde169 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 10 Mar 2022 16:57:54 +0800 Subject: test: add a test for #17489 --- test/functional/editor/completion_spec.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test') diff --git a/test/functional/editor/completion_spec.lua b/test/functional/editor/completion_spec.lua index befad29922..1a0ee54505 100644 --- a/test/functional/editor/completion_spec.lua +++ b/test/functional/editor/completion_spec.lua @@ -1193,4 +1193,23 @@ describe('completion', function() eq('foobar', eval('g:word')) feed('') end) + + it('does not crash if text is changed by first call to complete function #17489', function() + source([[ + func Complete(findstart, base) abort + if a:findstart + let col = col('.') + call complete_add('#') + return col - 1 + else + return [] + endif + endfunc + + set completeopt=longest + set completefunc=Complete + ]]) + feed('ifoo#') + assert_alive() + end) end) -- cgit