}
}
- // If complete() was called then compl_pattern has been reset. The
- // following won't work then, bail out.
- if (compl_pattern.string == NULL)
- break;
-
if (compl_autocomplete && type == CTRL_X_FUNCTION)
// LSP servers may sporadically take >1s to respond (e.g., while
// loading modules), but other sources might already have matches.
// get the next set of completion matches
found_new_match = get_next_completion_match(type, &st, &start_pos);
+ // If complete() was called then compl_pattern has been reset. The
+ // following won't work then, bail out.
+ if (compl_pattern.string == NULL)
+ break;
+
if (may_advance_cpt_idx)
{
if (!advance_cpt_sources_index_safe())
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