diff --git a/src/fuzzy.c b/src/fuzzy.c index 15e3c4cdbe..9a94acea20 100644 --- a/src/fuzzy.c +++ b/src/fuzzy.c @@ -816,7 +816,8 @@ search_for_fuzzy_match( { // Check if looped around and back to start position - if (looped_around && EQUAL_POS(current_pos, circly_end)) + if (looped_around && (whole_line ? current_pos.lnum == circly_end.lnum + : EQUAL_POS(current_pos, circly_end))) break; // Ensure current_pos is valid diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim index 5d93a4248d..7e92bac69e 100644 --- a/src/testdir/test_ins_complete.vim +++ b/src/testdir/test_ins_complete.vim @@ -3835,6 +3835,31 @@ func Test_complete_fuzzy_collect() set completeopt& cpt& ignorecase& infercase& endfunc +" Issue #19434 +" Fuzzy whole-line completion should not loop infinitely when the cursor is in +" the middle of the line (non-zero column). +func Test_complete_fuzzy_wholeline_no_hang() + new + set completeopt=preview,fuzzy,noinsert,menuone + call setline(1, [ + \ '', + \ '', + \ ' ', + \ ' ', + \ ' ', + \ '
', + \ '
', + \ ' ', + \ '', + \ ]) + call cursor(6, 1) + call feedkeys("faC\\\0", 'tx!') + call assert_equal('