mirror of
https://github.com/vim/vim.git
synced 2025-11-16 23:24:03 -05:00
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>
This commit is contained in:
committed by
Christian Brabandt
parent
41ba26566f
commit
58d705238c
@@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user