0
0
mirror of https://github.com/vim/vim.git synced 2025-11-16 23:24:03 -05:00

patch 9.1.0534: completion wrong with fuzzy when cycling back to original

Problem:  completion wrong with fuzzy when cycling back to original
          (Quan Nguyen)
Solution: reset show_match_ok when cp_score is zero (glepnir)

fixes: #15095
closes: #15105

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
glepnir
2024-07-06 16:09:19 +02:00
committed by Christian Brabandt
parent 719714383e
commit 65407ce1d2
5 changed files with 61 additions and 3 deletions

View File

@@ -1307,6 +1307,11 @@ ins_compl_build_pum(void)
did_find_shown_match = TRUE;
max_fuzzy_score = compl->cp_score;
compl_shown_match = compl;
}
if (!shown_match_ok && compl == compl_shown_match && !compl_no_select)
{
cur = i;
shown_match_ok = TRUE;
}
@@ -1318,8 +1323,6 @@ ins_compl_build_pum(void)
&& (max_fuzzy_score > 0
|| (compl_leader == NULL || lead_len == 0)))
{
shown_match_ok = TRUE;
cur = 0;
if (match_at_original_text(compl_shown_match))
compl_shown_match = shown_compl;
}
@@ -1367,6 +1370,7 @@ ins_compl_build_pum(void)
// sort by the largest score of fuzzy match
qsort(compl_match_array, (size_t)compl_match_arraysize,
sizeof(pumitem_T), ins_compl_fuzzy_cmp);
shown_match_ok = TRUE;
}
if (!shown_match_ok) // no displayed match at all
@@ -4102,7 +4106,8 @@ find_comp_when_fuzzy(void)
if ((is_forward && compl_selected_item == compl_match_arraysize - 1)
|| (is_backward && compl_selected_item == 0))
return compl_first_match;
return compl_first_match != compl_shown_match ? compl_first_match :
(compl_first_match->cp_prev ? compl_first_match->cp_prev : NULL);
if (is_forward)
target_idx = compl_selected_item + 1;