aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_cmdline.vim
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2022-02-27 04:36:04 +0000
committerzeertzjq <zeertzjq@outlook.com>2023-01-17 14:01:26 +0800
commit0c689fec8e7e1c9eb0bcdf84949160cd7caf3fb6 (patch)
tree222e1a6ebec01aeb522a87861047bf8cdf9ede2e /src/nvim/testdir/test_cmdline.vim
parent6734dd250355f8621a710d59c2089b38a65dbf18 (diff)
downloadrneovim-0c689fec8e7e1c9eb0bcdf84949160cd7caf3fb6.tar.gz
rneovim-0c689fec8e7e1c9eb0bcdf84949160cd7caf3fb6.tar.bz2
rneovim-0c689fec8e7e1c9eb0bcdf84949160cd7caf3fb6.zip
vim-patch:8.2.4465: fuzzy completion does not order matches properly
Problem: Fuzzy completion does not order matches properly. Solution: Do not use regular expression match. (Yegappan Lakshmanan, closes vim/vim#9843) https://github.com/vim/vim/commit/5ec633b9b0400519db60253cb5846e50394218b4 Nvim's ExpandGeneric() was refactored to eliminate looping for "round", so the patch has been adapted. fuzzy_match_str() change was already applied earlier. In Test_wildoptions_fuzzy(), test for NvimParenthesis over MatchParen for :syntax list, as the fuzzy matching algorithm prefers the former (even in Vim). Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/nvim/testdir/test_cmdline.vim')
-rw-r--r--src/nvim/testdir/test_cmdline.vim23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim
index e068685164..f5726c093b 100644
--- a/src/nvim/testdir/test_cmdline.vim
+++ b/src/nvim/testdir/test_cmdline.vim
@@ -2941,7 +2941,9 @@ func Test_wildoptions_fuzzy()
call assert_equal('"syntax list mpar', @:)
set wildoptions=fuzzy
call feedkeys(":syntax list mpar\<Tab>\<C-B>\"\<CR>", 'tx')
- call assert_equal('"syntax list MatchParen', @:)
+ " Fuzzy match favours NvimParenthesis over MatchParen
+ " call assert_equal('"syntax list MatchParen', @:)
+ call assert_equal('"syntax list NvimParenthesis', @:)
" :syntime suboptions fuzzy completion
if has('profile')
@@ -2968,6 +2970,25 @@ func Test_wildoptions_fuzzy()
call feedkeys(":let SVar\<Tab>\<C-B>\"\<CR>", 'tx')
call assert_equal('"let SomeVariable', @:)
+ " Test for sorting the results by the best match
+ %bw!
+ command T123format :
+ command T123goformat :
+ command T123TestFOrmat :
+ command T123fendoff :
+ command T123state :
+ command T123FendingOff :
+ set wildoptions=fuzzy
+ call feedkeys(":T123fo\<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"T123format T123TestFOrmat T123FendingOff T123goformat T123fendoff', @:)
+ delcommand T123format
+ delcommand T123goformat
+ delcommand T123TestFOrmat
+ delcommand T123fendoff
+ delcommand T123state
+ delcommand T123FendingOff
+ %bw
+
set wildoptions&
%bw!
endfunc