mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 10:45:16 -07:00
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
58d705238c
This commit is contained in:
parent
af199f9f02
commit
b53ba9d9a7
@ -3171,7 +3171,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".
|
||||
|
@ -5311,9 +5311,9 @@ describe('builtin popupmenu', function()
|
||||
{2:-- }{5:match 2 of 3} |
|
||||
]])
|
||||
|
||||
feed('<Esc>S/non_exit_folder<C-X><C-F>')
|
||||
feed('<Esc>S/non_existing_folder<C-X><C-F>')
|
||||
screen:expect([[
|
||||
/non_exit_folder^ |
|
||||
/non_existing_folder^ |
|
||||
{1:~ }|*18
|
||||
{2:-- }{6:Pattern not found} |
|
||||
]])
|
||||
|
@ -1514,7 +1514,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', {})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user