mirror of
https://github.com/neovim/neovim.git
synced 2026-02-20 01:09:56 +10:00
vim-patch:9.1.0484: Sorting of completeopt+=fuzzy is not stable (#29338)
Problem: Sorting of completeopt+=fuzzy is not stable.
Solution: Compare original indexes when scores are the same.
(zeertzjq)
closes: vim/vim#14988
8e56747fd2
This commit is contained in:
@@ -2639,4 +2639,24 @@ func Test_complete_fuzzy_match()
|
||||
unlet g:word
|
||||
endfunc
|
||||
|
||||
" Check that tie breaking is stable for completeopt+=fuzzy (which should
|
||||
" behave the same on different platforms).
|
||||
func Test_complete_fuzzy_match_tie()
|
||||
new
|
||||
set completeopt+=fuzzy,noselect
|
||||
call setline(1, ['aaabbccc', 'aaabbCCC', 'aaabbcccc', 'aaabbCCCC', ''])
|
||||
|
||||
call feedkeys("Gcc\<C-X>\<C-N>ab\<C-N>\<C-Y>", 'tx')
|
||||
call assert_equal('aaabbccc', getline('.'))
|
||||
call feedkeys("Gcc\<C-X>\<C-N>ab\<C-N>\<C-N>\<C-Y>", 'tx')
|
||||
call assert_equal('aaabbCCC', getline('.'))
|
||||
call feedkeys("Gcc\<C-X>\<C-N>ab\<C-N>\<C-N>\<C-N>\<C-Y>", 'tx')
|
||||
call assert_equal('aaabbcccc', getline('.'))
|
||||
call feedkeys("Gcc\<C-X>\<C-N>ab\<C-N>\<C-N>\<C-N>\<C-N>\<C-Y>", 'tx')
|
||||
call assert_equal('aaabbCCCC', getline('.'))
|
||||
|
||||
bwipe!
|
||||
set completeopt&
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab nofoldenable
|
||||
|
||||
Reference in New Issue
Block a user