1
0
forked from aniani/vim

patch 9.1.1053: "nosort" enables fuzzy filtering even if "fuzzy" isn't in 'completeopt'

Problem:  "nosort" enables fuzzy filtering even if "fuzzy" isn't in
          'completeopt' (after v9.1.1049)
Solution: Only enable fuzzy filtering when "fuzzy" is in 'completeopt'.
          (zeertzjq)

closes: #16510

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2025-01-25 15:29:03 +01:00
committed by Christian Brabandt
parent 509a8d58f9
commit d65aa1bbdb
3 changed files with 14 additions and 7 deletions

View File

@@ -2857,8 +2857,8 @@ func Test_complete_fuzzy_match()
" test case for nosort option
set cot=menuone,menu,noinsert,fuzzy,nosort
" fooBaz" should have a higher score when the leader is "fb".
" With `nosort`, "foobar" should still be shown first in the popup menu.
" "fooBaz" should have a higher score when the leader is "fb".
" With "nosort", "foobar" should still be shown first in the popup menu.
call feedkeys("S\<C-x>\<C-o>fb", 'tx')
call assert_equal('foobar', g:word)
call feedkeys("S\<C-x>\<C-o>好", 'tx')
@@ -2870,6 +2870,11 @@ func Test_complete_fuzzy_match()
call feedkeys("S\<C-x>\<C-o>好\<C-N>", 'tx')
call assert_equal('你好吗', g:word)
" "nosort" shouldn't enable fuzzy filtering when "fuzzy" isn't present.
set cot=menuone,noinsert,nosort
call feedkeys("S\<C-x>\<C-o>fooB\<C-Y>", 'tx')
call assert_equal('fooBaz', getline('.'))
" clean up
set omnifunc=
bw!