diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2024-09-01 06:22:37 +0800 |
|---|---|---|
| committer | zeertzjq <zeertzjq@outlook.com> | 2025-03-27 07:26:42 +0800 |
| commit | 767a52ba308655f72ac4d255b4f13fd2c635f6d1 (patch) | |
| tree | 500019b4c8fc60f5ace447ae6b9199cdd0306966 /src | |
| parent | f4ddbaeb9e3dd68f8d6b90e805246a24b7960019 (diff) | |
| download | rneovim-767a52ba308655f72ac4d255b4f13fd2c635f6d1.tar.gz rneovim-767a52ba308655f72ac4d255b4f13fd2c635f6d1.tar.bz2 rneovim-767a52ba308655f72ac4d255b4f13fd2c635f6d1.zip | |
vim-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: vim/vim#15593
https://github.com/vim/vim/commit/58d705238c0794ee3baa4173831ab157e709a48a
Diffstat (limited to 'src')
| -rw-r--r-- | src/nvim/insexpand.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c index af26e882dc..f2ad4c0757 100644 --- a/src/nvim/insexpand.c +++ b/src/nvim/insexpand.c @@ -3306,7 +3306,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); } /// Get the next set of filename matching "compl_pattern". |