diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2024-06-15 04:33:19 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-15 04:33:19 +0800 |
| commit | fd950d4998a497cb4258d35af72408105900296a (patch) | |
| tree | 195b7aadba5965676ccea06dc3e89c72239425fc /test | |
| parent | aa47af7e69bb32c4486510dce27f45d9028e0a6c (diff) | |
| download | rneovim-fd950d4998a497cb4258d35af72408105900296a.tar.gz rneovim-fd950d4998a497cb4258d35af72408105900296a.tar.bz2 rneovim-fd950d4998a497cb4258d35af72408105900296a.zip | |
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
https://github.com/vim/vim/commit/8e56747fd26b3b040b6fcbfb6be41b7d5922c6b5
Diffstat (limited to 'test')
| -rw-r--r-- | test/old/testdir/test_ins_complete.vim | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index fd77da67f8..ac08da9743 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -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 |