aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-06-05 15:02:20 +0800
committerzeertzjq <zeertzjq@outlook.com>2024-06-05 15:08:31 +0800
commit818cb27e4843e410df9cc6db11efb33e26bc1b41 (patch)
treea4094336107761d050e491d61d6686f2c5aa3efb /src
parentc2e836c41cabef3c5e269b5f6401f272112c75e1 (diff)
downloadrneovim-818cb27e4843e410df9cc6db11efb33e26bc1b41.tar.gz
rneovim-818cb27e4843e410df9cc6db11efb33e26bc1b41.tar.bz2
rneovim-818cb27e4843e410df9cc6db11efb33e26bc1b41.zip
vim-patch:9.1.0466: Missing comments for fuzzy completion
Problem: Missing comments for fuzzy completion (after 9.1.0463) Solution: Add more comments, adjust indentation slightly (glepnir) closes: vim/vim#14910 https://github.com/vim/vim/commit/dca57fb54200530a0874c90fab799a689c00c597 Co-authored-by: glepnir <glephunter@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/nvim/insexpand.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c
index 783156dc2b..77fae4dd18 100644
--- a/src/nvim/insexpand.c
+++ b/src/nvim/insexpand.c
@@ -1249,6 +1249,8 @@ static int ins_compl_build_pum(void)
}
cur = i;
} else if (compl_fuzzy_match) {
+ // Update the maximum fuzzy score and the shown match
+ // if the current item's score is higher
if (comp->cp_score > max_fuzzy_score) {
did_find_shown_match = true;
max_fuzzy_score = comp->cp_score;
@@ -1256,6 +1258,10 @@ static int ins_compl_build_pum(void)
shown_match_ok = true;
}
+ // If there is no "no select" condition and the max fuzzy
+ // score is positive, or there is no completion leader or the
+ // leader length is zero, mark the shown match as valid and
+ // reset the current index.
if (!compl_no_select
&& (max_fuzzy_score > 0
|| (compl_leader == NULL || lead_len == 0))) {
@@ -3633,6 +3639,7 @@ static void ins_compl_show_filename(void)
redraw_cmdline = false; // don't overwrite!
}
+/// find a completion item in when completeopt include fuzzy option
static compl_T *find_comp_when_fuzzy(void)
{
int target_idx = -1;