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

d8648f7279

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
This commit is contained in:
zeertzjq
2026-02-20 08:59:04 +08:00
parent 08b8fe5ab3
commit 6e8a1a8988
2 changed files with 27 additions and 1 deletions

View File

@@ -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;
}

View File

@@ -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