From 6e8a1a8988562757a979886e333034eb3eac70ea Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 20 Feb 2026 08:59:04 +0800 Subject: [PATCH] vim-patch:9.2.0032: completion: hang with line completion and fuzzy Problem: completion: hang with line completion and fuzzy (Jesse Pavel) Solution: Only check the line number when wrapping around the file (Hirohito Higashi). fixes: vim/vim#19434 closes: vim/vim#19443 https://github.com/vim/vim/commit/d8648f7279f5a61aaa9ceebc7330e09800947a35 Co-authored-by: Hirohito Higashi --- src/nvim/fuzzy.c | 3 ++- test/old/testdir/test_ins_complete.vim | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/nvim/fuzzy.c b/src/nvim/fuzzy.c index 9a9e95dda6..4d7f6a08e0 100644 --- a/src/nvim/fuzzy.c +++ b/src/nvim/fuzzy.c @@ -614,7 +614,8 @@ bool search_for_fuzzy_match(buf_T *buf, pos_T *pos, char *pattern, int dir, pos_ while (true) { // Check if looped around and back to start position - if (looped_around && equalpos(current_pos, circly_end)) { + if (looped_around && (whole_line ? current_pos.lnum == circly_end.lnum + : equalpos(current_pos, circly_end))) { break; } diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index 68d0b9facb..f844f44a2c 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -3946,6 +3946,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('