Skip to content

Commit 58d7052

Browse files
zeertzjqchrisbra
authored andcommitted
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 <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 41ba265 commit 58d7052

5 files changed

Lines changed: 7 additions & 4 deletions

File tree

src/insexpand.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3546,7 +3546,8 @@ static int compare_scores(const void *a, const void *b)
35463546
int idx_b = *(const int *)b;
35473547
int score_a = compl_fuzzy_scores[idx_a];
35483548
int score_b = compl_fuzzy_scores[idx_b];
3549-
return (score_a > score_b) ? -1 : (score_a < score_b) ? 1 : 0;
3549+
return score_a == score_b ? (idx_a == idx_b ? 0 : (idx_a < idx_b ? -1 : 1))
3550+
: (score_a > score_b ? -1 : 1);
35503551
}
35513552

35523553
/*

src/search.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5217,7 +5217,7 @@ search_for_fuzzy_match(
52175217
{
52185218
pos_T current_pos = *pos;
52195219
pos_T circly_end;
5220-
int found_new_match = FAIL;
5220+
int found_new_match = FALSE;
52215221
int looped_around = FALSE;
52225222

52235223
if (whole_line)

src/testdir/dumps/Test_pum_highlights_15.dump

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
|/+0&#ffffff0|n|o|n|_|e|x|i|t|_|f|o|l|d|e|r> @58
1+
|/+0&#ffffff0|n|o|n|_|e|x|i|s|t|i|n|g|_|f|o|l|d|e|r> @54
22
|~+0#4040ff13&| @73
33
|~| @73
44
|~| @73

src/testdir/test_popup.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1494,7 +1494,7 @@ func Test_pum_highlights_match()
14941494
call VerifyScreenDump(buf, 'Test_pum_highlights_11', {})
14951495

14961496
" issue #15357
1497-
call term_sendkeys(buf, "\<ESC>S/non_exit_folder\<C-X>\<C-F>")
1497+
call term_sendkeys(buf, "\<ESC>S/non_existing_folder\<C-X>\<C-F>")
14981498
call TermWait(buf, 50)
14991499
call VerifyScreenDump(buf, 'Test_pum_highlights_15', {})
15001500

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
705,
707709
/**/
708710
704,
709711
/**/

0 commit comments

Comments
 (0)