aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2025-02-14 09:09:01 +0800
committerGitHub <noreply@github.com>2025-02-14 09:09:01 +0800
commitf247402010d92aa4dc90cc979e33ea6e47f49ee6 (patch)
treedf6deaa84a284c7c51882e5a5b010496dc18b61c /test
parent478c71f03cfdf0d97f3f17e4264fbcf83f4f16f6 (diff)
downloadrneovim-f247402010d92aa4dc90cc979e33ea6e47f49ee6.tar.gz
rneovim-f247402010d92aa4dc90cc979e33ea6e47f49ee6.tar.bz2
rneovim-f247402010d92aa4dc90cc979e33ea6e47f49ee6.zip
vim-patch:9.1.1107: cannot loop through completion menu with fuzzy (#32438)
Problem: cannot loop through completion menu with fuzzy and nosort in 'completeopt' (Tomasz N) Solution: Reset cur to zero and update compl_shown_match when 'completeopt' contains "nosort" but not "noselect" (glepnir) fixes: vim/vim#16624 closes: vim/vim#16629 https://github.com/vim/vim/commit/c0b7ca406ba18640c56e2746d6f6d03549d53072 Co-authored-by: glepnir <glephunter@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_ins_complete.vim19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim
index 2fb1715634..f4dd2fbd10 100644
--- a/test/old/testdir/test_ins_complete.vim
+++ b/test/old/testdir/test_ins_complete.vim
@@ -2767,6 +2767,8 @@ func Test_complete_fuzzy_match()
func OnPumChange()
let g:item = get(v:event, 'completed_item', {})
let g:word = get(g:item, 'word', v:null)
+ let g:abbr = get(g:item, 'abbr', v:null)
+ let g:selected = get(complete_info(['selected']), 'selected')
endfunction
augroup AAAAA_Group
@@ -2857,6 +2859,20 @@ func Test_complete_fuzzy_match()
call feedkeys("S\<C-x>\<C-o>fooB\<C-Y>", 'tx')
call assert_equal('fooBaz', getline('.'))
+ set cot=menuone,fuzzy,nosort
+ func CompAnother()
+ call complete(col('.'), [#{word: "do" }, #{word: "echo"}, #{word: "for (${1:expr1}, ${2:expr2}, ${3:expr3}) {\n\t$0\n}", abbr: "for" }, #{word: "foo"}])
+ return ''
+ endfunc
+ call feedkeys("i\<C-R>=CompAnother()\<CR>\<C-N>\<C-N>", 'tx')
+ call assert_equal("for", g:abbr)
+ call assert_equal(2, g:selected)
+
+ set cot+=noinsert
+ call feedkeys("i\<C-R>=CompAnother()\<CR>f", 'tx')
+ call assert_equal("for", g:abbr)
+ call assert_equal(2, g:selected)
+
" clean up
set omnifunc=
bw!
@@ -2866,8 +2882,11 @@ func Test_complete_fuzzy_match()
delfunc OnPumChange
delfunc Omni_test
delfunc Comp
+ delfunc CompAnother
unlet g:item
unlet g:word
+ unlet g:selected
+ unlet g:abbr
endfunc
" Check that tie breaking is stable for completeopt+=fuzzy (which should