mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04: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:
parent
719714383e
commit
65407ce1d2
@ -1307,6 +1307,11 @@ ins_compl_build_pum(void)
|
|||||||
did_find_shown_match = TRUE;
|
did_find_shown_match = TRUE;
|
||||||
max_fuzzy_score = compl->cp_score;
|
max_fuzzy_score = compl->cp_score;
|
||||||
compl_shown_match = compl;
|
compl_shown_match = compl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!shown_match_ok && compl == compl_shown_match && !compl_no_select)
|
||||||
|
{
|
||||||
|
cur = i;
|
||||||
shown_match_ok = TRUE;
|
shown_match_ok = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1318,8 +1323,6 @@ ins_compl_build_pum(void)
|
|||||||
&& (max_fuzzy_score > 0
|
&& (max_fuzzy_score > 0
|
||||||
|| (compl_leader == NULL || lead_len == 0)))
|
|| (compl_leader == NULL || lead_len == 0)))
|
||||||
{
|
{
|
||||||
shown_match_ok = TRUE;
|
|
||||||
cur = 0;
|
|
||||||
if (match_at_original_text(compl_shown_match))
|
if (match_at_original_text(compl_shown_match))
|
||||||
compl_shown_match = shown_compl;
|
compl_shown_match = shown_compl;
|
||||||
}
|
}
|
||||||
@ -1367,6 +1370,7 @@ ins_compl_build_pum(void)
|
|||||||
// sort by the largest score of fuzzy match
|
// sort by the largest score of fuzzy match
|
||||||
qsort(compl_match_array, (size_t)compl_match_arraysize,
|
qsort(compl_match_array, (size_t)compl_match_arraysize,
|
||||||
sizeof(pumitem_T), ins_compl_fuzzy_cmp);
|
sizeof(pumitem_T), ins_compl_fuzzy_cmp);
|
||||||
|
shown_match_ok = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!shown_match_ok) // no displayed match at all
|
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)
|
if ((is_forward && compl_selected_item == compl_match_arraysize - 1)
|
||||||
|| (is_backward && compl_selected_item == 0))
|
|| (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)
|
if (is_forward)
|
||||||
target_idx = compl_selected_item + 1;
|
target_idx = compl_selected_item + 1;
|
||||||
|
20
src/testdir/dumps/Test_pum_highlights_10.dump
Normal file
20
src/testdir/dumps/Test_pum_highlights_10.dump
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
| +0&#ffffff0|h|e|l@1|o| |h|e|l|i|o| |h|e|r|o| |h|e|r|o> @52
|
||||||
|
|~+0#4040ff13&| @15| +0#0000001#ffd7ff255|h+0#0000e05&|e+0#0000001&|l@1|o| @9| +0#4040ff13#ffffff0@41
|
||||||
|
|~| @15| +0#0000001#ffd7ff255|h+0#0000e05&|e+0#0000001&|l|i|o| @9| +0#4040ff13#ffffff0@41
|
||||||
|
|~| @15| +0#0000001#e0e0e08|h+0#00e0e07&|e+0#0000001&|r|o| @10| +0#4040ff13#ffffff0@41
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|-+2#0000000&@1| |K|e|y|w|o|r|d| |L|o|c|a|l| |c|o|m|p|l|e|t|i|o|n| |(|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |3| +0#0000000&@27
|
20
src/testdir/dumps/Test_pum_highlights_11.dump
Normal file
20
src/testdir/dumps/Test_pum_highlights_11.dump
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
| +0&#ffffff0|h|e|l@1|o| |h|e|l|i|o| |h|e|r|o| |h|e|l|i|o> @51
|
||||||
|
|~+0#4040ff13&| @15| +0#0000001#ffd7ff255|h+0#0000e05&|e+0#0000001&|l@1|o| @9| +0#4040ff13#ffffff0@41
|
||||||
|
|~| @15| +0#0000001#e0e0e08|h+0#00e0e07&|e+0#0000001&|l|i|o| @9| +0#4040ff13#ffffff0@41
|
||||||
|
|~| @15| +0#0000001#ffd7ff255|h+0#0000e05&|e+0#0000001&|r|o| @10| +0#4040ff13#ffffff0@41
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|-+2#0000000&@1| |K|e|y|w|o|r|d| |L|o|c|a|l| |c|o|m|p|l|e|t|i|o|n| |(|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |2| |o|f| |3| +0#0000000&@27
|
@ -1482,6 +1482,17 @@ func Test_pum_highlights_match()
|
|||||||
call term_sendkeys(buf, "o\<BS>\<C-R>=Comp()\<CR>")
|
call term_sendkeys(buf, "o\<BS>\<C-R>=Comp()\<CR>")
|
||||||
call VerifyScreenDump(buf, 'Test_pum_highlights_09', {})
|
call VerifyScreenDump(buf, 'Test_pum_highlights_09', {})
|
||||||
|
|
||||||
|
" issue #15095 wrong select
|
||||||
|
call term_sendkeys(buf, "\<ESC>:set completeopt=fuzzy,menu\<CR>")
|
||||||
|
call TermWait(buf)
|
||||||
|
call term_sendkeys(buf, "S hello helio hero h\<C-X>\<C-P>")
|
||||||
|
call TermWait(buf, 50)
|
||||||
|
call VerifyScreenDump(buf, 'Test_pum_highlights_10', {})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, "\<ESC>S hello helio hero h\<C-X>\<C-P>\<C-P>")
|
||||||
|
call TermWait(buf, 50)
|
||||||
|
call VerifyScreenDump(buf, 'Test_pum_highlights_11', {})
|
||||||
|
|
||||||
call term_sendkeys(buf, "\<C-E>\<Esc>")
|
call term_sendkeys(buf, "\<C-E>\<Esc>")
|
||||||
call TermWait(buf)
|
call TermWait(buf)
|
||||||
|
|
||||||
|
@ -704,6 +704,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
534,
|
||||||
/**/
|
/**/
|
||||||
533,
|
533,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user