patch 9.1.1107: cannot loop through completion menu with fuzzy
Problem: cannot loop through completion menu with fuzzy and nosort in
'completeopt'
(Tomasz N)
Solution: Reset cur to zero and update compl_shown_match when
'completeopt' contains "nosort" but not "noselect"
(glepnir)
fixes: #16624
closes: #16629
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/insexpand.c b/src/insexpand.c
index 85b3269..7d04690 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -1367,8 +1367,6 @@
if (!compl_no_select)
compl_shown_match = compl;
}
- else if (!fuzzy_sort && i == 0 && !compl_no_select)
- compl_shown_match = shown_compl;
if (!shown_match_ok && compl == compl_shown_match && !compl_no_select)
{
@@ -1402,6 +1400,13 @@
if (compl_match_arraysize == 0)
return -1;
+ if (fuzzy_filter && !fuzzy_sort && !compl_no_select && !shown_match_ok)
+ {
+ compl_shown_match = shown_compl;
+ shown_match_ok = TRUE;
+ cur = 0;
+ }
+
compl_match_array = ALLOC_CLEAR_MULT(pumitem_T, compl_match_arraysize);
if (compl_match_array == NULL)
return -1;