mirror of
https://github.com/neovim/neovim.git
synced 2026-03-31 04:42:03 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user