commit 6e8a1a8988562757a979886e333034eb3eac70ea
parent 08b8fe5ab36ee3df3ce593942565d4cd318373c4
Author: zeertzjq <zeertzjq@outlook.com>
Date: Fri, 20 Feb 2026 08:59:04 +0800
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 <h.east.727@gmail.com>
Diffstat:
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git 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
@@ -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, [
+ \ '<!DOCTYPE html>',
+ \ '<html lang="en-US">',
+ \ ' <head>',
+ \ ' </head>',
+ \ ' <body>',
+ \ ' <div class="page-landscape">',
+ \ ' </div>',
+ \ ' </body>',
+ \ '</html>',
+ \ ])
+ call cursor(6, 1)
+ call feedkeys("faC\<C-X>\<C-L>\<Esc>0", 'tx!')
+ call assert_equal(' <div cl', getline(6))
+
+ bw!
+ set completeopt&
+endfunc
+
" Issue #18752
func Test_complete_fuzzy_collect_multiwin()
new