]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0032: completion: hang with line completion and fuzzy v9.2.0032
authorHirohito Higashi <h.east.727@gmail.com>
Thu, 19 Feb 2026 17:35:55 +0000 (17:35 +0000)
committerChristian Brabandt <cb@256bit.org>
Thu, 19 Feb 2026 17:40:04 +0000 (17:40 +0000)
Problem:  completion: hang with line completion and fuzzy (Jesse Pavel)
Solution: Only check the line number when wrapping around the file
          (Hirohito Higashi).

fixes:  #19434
closes: #19443

Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/fuzzy.c
src/testdir/test_ins_complete.vim
src/version.c

index 15e3c4cdbe4d4c73209a89271cff3bd4795bef93..9a94acea200f4a6399f608b8918fb086c01cd9cb 100644 (file)
@@ -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
index 5d93a4248d77fb5d8270917471c77640e9d493c2..7e92bac69edf113b3faa6563200d8ed5260c859f 100644 (file)
@@ -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, [
+        \ '<!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
index b929dea0fb0c88ddcba3090563b8efd4f21d166a..eb20c82739fd8b0e99751f2038dd83486f030513 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    32,
 /**/
     31,
 /**/