diff options
author | zeertzjq <zeertzjq@outlook.com> | 2025-01-25 22:34:54 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2025-01-25 22:39:40 +0800 |
commit | 689c23b2ac5c8cb5953e45f9f0cf6c369e8d88df (patch) | |
tree | 068e140507ac1b722898b93cc485e3e595095c3f /src | |
parent | 63aa167f944b147b9d4b8c417a37f4beb212d984 (diff) | |
download | rneovim-689c23b2ac5c8cb5953e45f9f0cf6c369e8d88df.tar.gz rneovim-689c23b2ac5c8cb5953e45f9f0cf6c369e8d88df.tar.bz2 rneovim-689c23b2ac5c8cb5953e45f9f0cf6c369e8d88df.zip |
vim-patch:9.1.1053: "nosort" enables fuzzy filtering even if "fuzzy" isn't in 'completeopt'
Problem: "nosort" enables fuzzy filtering even if "fuzzy" isn't in
'completeopt' (after v9.1.1049)
Solution: Only enable fuzzy filtering when "fuzzy" is in 'completeopt'.
(zeertzjq)
closes: vim/vim#16510
https://github.com/vim/vim/commit/d65aa1bbdb808ef8fecde6df240c48cc39a52a8e
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/insexpand.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c index 83e0602e7e..8eb1a49e7d 100644 --- a/src/nvim/insexpand.c +++ b/src/nvim/insexpand.c @@ -1212,8 +1212,8 @@ static int ins_compl_build_pum(void) int max_fuzzy_score = 0; unsigned cur_cot_flags = get_cot_flags(); bool compl_no_select = (cur_cot_flags & kOptCotFlagNoselect) != 0; - bool fuzzy_nosort = (cur_cot_flags & kOptCotFlagNosort) != 0; - bool fuzzy_filter = fuzzy_nosort || (cur_cot_flags & kOptCotFlagFuzzy) != 0; + bool fuzzy_filter = (cur_cot_flags & kOptCotFlagFuzzy) != 0; + bool fuzzy_sort = fuzzy_filter && !(cur_cot_flags & kOptCotFlagNosort); compl_T *match_head = NULL, *match_tail = NULL; // If the current match is the original text don't find the first @@ -1268,13 +1268,13 @@ static int ins_compl_build_pum(void) } // Update the maximum fuzzy score and the shown match // if the current item's score is higher - if (!fuzzy_nosort && comp->cp_score > max_fuzzy_score) { + if (fuzzy_sort && comp->cp_score > max_fuzzy_score) { did_find_shown_match = true; max_fuzzy_score = comp->cp_score; if (!compl_no_select) { compl_shown_match = comp; } - } else if (fuzzy_nosort && i == 0 && !compl_no_select) { + } else if (!fuzzy_sort && i == 0 && !compl_no_select) { compl_shown_match = shown_compl; } if (!shown_match_ok && comp == compl_shown_match && !compl_no_select) { @@ -1326,7 +1326,7 @@ static int ins_compl_build_pum(void) comp = match_next; } - if (fuzzy_filter && !fuzzy_nosort && compl_leader.data != NULL && compl_leader.size > 0) { + if (fuzzy_sort && compl_leader.data != NULL && compl_leader.size > 0) { for (i = 0; i < compl_match_arraysize; i++) { compl_match_array[i].pum_idx = i; } |