diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2024-06-05 15:26:24 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-05 15:26:24 +0800 |
| commit | e41597c510b4708c3192aa7573137e0fe9468a3a (patch) | |
| tree | a4094336107761d050e491d61d6686f2c5aa3efb /test | |
| parent | f69937fdbd162630c35e119e67bbbf052558c0e0 (diff) | |
| parent | 818cb27e4843e410df9cc6db11efb33e26bc1b41 (diff) | |
| download | rneovim-e41597c510b4708c3192aa7573137e0fe9468a3a.tar.gz rneovim-e41597c510b4708c3192aa7573137e0fe9468a3a.tar.bz2 rneovim-e41597c510b4708c3192aa7573137e0fe9468a3a.zip | |
Merge pull request #29200 from zeertzjq/vim-9.1.0463
vim-patch:9.1.{0463,0466}
Diffstat (limited to 'test')
| -rw-r--r-- | test/old/testdir/test_ins_complete.vim | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index 45db2a7364..ba5e5acce9 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -2512,4 +2512,60 @@ func Test_completefunc_first_call_complete_add() bwipe! endfunc +func Test_complete_fuzzy_match() + func OnPumChange() + let g:item = get(v:event, 'completed_item', {}) + let g:word = get(g:item, 'word', v:null) + endfunction + + augroup AAAAA_Group + au! + autocmd CompleteChanged * :call OnPumChange() + augroup END + + func Omni_test(findstart, base) + if a:findstart + return col(".") + endif + return [#{word: "foo"}, #{word: "foobar"}, #{word: "fooBaz"}, #{word: "foobala"}] + endfunc + new + set omnifunc=Omni_test + set completeopt+=noinsert,fuzzy + call feedkeys("Gi\<C-x>\<C-o>", 'tx') + call assert_equal('foo', g:word) + call feedkeys("S\<C-x>\<C-o>fb", 'tx') + call assert_equal('fooBaz', g:word) + call feedkeys("S\<C-x>\<C-o>fa", 'tx') + call assert_equal('foobar', g:word) + " select next + call feedkeys("S\<C-x>\<C-o>fb\<C-n>", 'tx') + call assert_equal('foobar', g:word) + " can circly select next + call feedkeys("S\<C-x>\<C-o>fb\<C-n>\<C-n>\<C-n>", 'tx') + call assert_equal(v:null, g:word) + " select prev + call feedkeys("S\<C-x>\<C-o>fb\<C-p>", 'tx') + call assert_equal(v:null, g:word) + " can circly select prev + call feedkeys("S\<C-x>\<C-o>fb\<C-p>\<C-p>\<C-p>\<C-p>", 'tx') + call assert_equal('fooBaz', g:word) + + " respect noselect + set completeopt+=noselect + call feedkeys("S\<C-x>\<C-o>fb", 'tx') + call assert_equal(v:null, g:word) + call feedkeys("S\<C-x>\<C-o>fb\<C-n>", 'tx') + call assert_equal('fooBaz', g:word) + + " clean up + set omnifunc= + bw! + set complete& completeopt& + autocmd! AAAAA_Group + augroup! AAAAA_Group + delfunc OnPumChange + delfunc Omni_test +endfunc + " vim: shiftwidth=2 sts=2 expandtab nofoldenable |