mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
Merge pull request #33282 from glepnir/vim-9.1.1269
vim-patch:9.1.{1269,1272}
This commit is contained in:
@@ -1291,6 +1291,12 @@ static int ins_compl_build_pum(void)
|
|||||||
// match after it, don't highlight anything.
|
// match after it, don't highlight anything.
|
||||||
bool shown_match_ok = match_at_original_text(compl_shown_match);
|
bool shown_match_ok = match_at_original_text(compl_shown_match);
|
||||||
|
|
||||||
|
bool update_shown_match = fuzzy_filter;
|
||||||
|
if (fuzzy_filter && ctrl_x_mode_normal()
|
||||||
|
&& compl_leader.data == NULL && compl_shown_match->cp_score > 0) {
|
||||||
|
update_shown_match = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (strequal(compl_leader.data, compl_orig_text.data) && !shown_match_ok) {
|
if (strequal(compl_leader.data, compl_orig_text.data) && !shown_match_ok) {
|
||||||
compl_shown_match = compl_no_select ? compl_first_match : compl_first_match->cp_next;
|
compl_shown_match = compl_no_select ? compl_first_match : compl_first_match->cp_next;
|
||||||
}
|
}
|
||||||
@@ -1339,7 +1345,7 @@ static int ins_compl_build_pum(void)
|
|||||||
}
|
}
|
||||||
// Update the maximum fuzzy score and the shown match
|
// Update the maximum fuzzy score and the shown match
|
||||||
// if the current item's score is higher
|
// if the current item's score is higher
|
||||||
if (fuzzy_sort && comp->cp_score > max_fuzzy_score) {
|
if (fuzzy_sort && comp->cp_score > max_fuzzy_score && update_shown_match) {
|
||||||
did_find_shown_match = true;
|
did_find_shown_match = true;
|
||||||
max_fuzzy_score = comp->cp_score;
|
max_fuzzy_score = comp->cp_score;
|
||||||
if (!compl_no_select) {
|
if (!compl_no_select) {
|
||||||
@@ -4237,7 +4243,7 @@ static compl_T *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 != compl_shown_match
|
return compl_first_match != compl_shown_match
|
||||||
? compl_first_match
|
? (is_forward ? compl_shown_match->cp_next : compl_first_match)
|
||||||
: (compl_first_match->cp_prev ? compl_first_match->cp_prev : NULL);
|
: (compl_first_match->cp_prev ? compl_first_match->cp_prev : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2861,6 +2861,14 @@ func Test_complete_opt_fuzzy()
|
|||||||
call feedkeys("i\<C-R>=CompAnother()\<CR>\<C-P>\<C-P>", 'tx')
|
call feedkeys("i\<C-R>=CompAnother()\<CR>\<C-P>\<C-P>", 'tx')
|
||||||
call assert_equal("for", g:abbr)
|
call assert_equal("for", g:abbr)
|
||||||
|
|
||||||
|
set cot=menu,fuzzy
|
||||||
|
call feedkeys("Sblue\<CR>bar\<CR>b\<C-X>\<C-P>\<C-Y>\<ESC>", 'tx')
|
||||||
|
call assert_equal('bar', getline('.'))
|
||||||
|
call feedkeys("Sb\<C-X>\<C-N>\<C-Y>\<ESC>", 'tx')
|
||||||
|
call assert_equal('blue', getline('.'))
|
||||||
|
call feedkeys("Sb\<C-X>\<C-P>\<C-N>\<C-Y>\<ESC>", 'tx')
|
||||||
|
call assert_equal('b', getline('.'))
|
||||||
|
|
||||||
" clean up
|
" clean up
|
||||||
set omnifunc=
|
set omnifunc=
|
||||||
bw!
|
bw!
|
||||||
|
Reference in New Issue
Block a user