patch 9.1.0705: Sorting of fuzzy filename completion is not stable
Commit:
https://github.com/vim/vim/commit/58d705238c0794ee3baa4173831ab157e709a48a
Author: zeertzjq <[email protected]>
Date: Sat Aug 31 17:05:39 2024 +0200
patch 9.1.0705: Sorting of fuzzy filename completion is not stable
Problem: Sorting of fuzzy filename completion is not stable
Solution: Compare indexes when scores are equal. Fix some typos.
(zeertzjq)
closes: #15593
Signed-off-by: zeertzjq <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/src/insexpand.c b/src/insexpand.c
index af818d4ad..d424fff00 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -3546,7 +3546,8 @@ static int compare_scores(const void *a, const void *b)
int idx_b = *(const int *)b;
int score_a = compl_fuzzy_scores[idx_a];
int score_b = compl_fuzzy_scores[idx_b];
- return (score_a > score_b) ? -1 : (score_a < score_b) ? 1 : 0;
+ return score_a == score_b ? (idx_a == idx_b ? 0 : (idx_a < idx_b ? -1 : 1))
+ : (score_a > score_b ? -1 : 1);
}
/*
diff --git a/src/search.c b/src/search.c
index e5936d829..a7fd44e68 100644
--- a/src/search.c
+++ b/src/search.c
@@ -5217,7 +5217,7 @@ search_for_fuzzy_match(
{
pos_T current_pos = *pos;
pos_T circly_end;
- int found_new_match = FAIL;
+ int found_new_match = FALSE;
int looped_around = FALSE;
if (whole_line)
diff --git a/src/testdir/dumps/Test_pum_highlights_15.dump
b/src/testdir/dumps/Test_pum_highlights_15.dump
index e923b439a..199f753af 100644
--- a/src/testdir/dumps/Test_pum_highlights_15.dump
+++ b/src/testdir/dumps/Test_pum_highlights_15.dump
@@ -1,4 +1,4 @@
-|/+0&#ffffff0|n|o|n|_|e|x|i|t|_|f|o|l|d|e|r> @58
+|/+0&#ffffff0|n|o|n|_|e|x|i|s|t|i|n|g|_|f|o|l|d|e|r> @54
|~+0#4040ff13&| @73
|~| @73
|~| @73
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index fe958da0e..caec8ff0f 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -1494,7 +1494,7 @@ func Test_pum_highlights_match()
call VerifyScreenDump(buf, 'Test_pum_highlights_11', {})
" issue #15357
- call term_sendkeys(buf, "\<ESC>S/non_exit_folder\<C-X>\<C-F>")
+ call term_sendkeys(buf, "\<ESC>S/non_existing_folder\<C-X>\<C-F>")
call TermWait(buf, 50)
call VerifyScreenDump(buf, 'Test_pum_highlights_15', {})
diff --git a/src/version.c b/src/version.c
index 44137b736..6d374eb78 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 705,
/**/
704,
/**/
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/E1skPoe-002bzb-8m%40256bit.org.