aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-08-30 15:37:24 +0800
committerzeertzjq <zeertzjq@outlook.com>2025-03-27 07:26:41 +0800
commitd5a6040967d8dd32b6cdeceb907ca4d50f56e4c2 (patch)
tree1cc3780100fdd88f537e1675b5376dbd4342ae8e /test
parent9acb52c8f386ea0a026ba4e314e1294da66f8e79 (diff)
downloadrneovim-d5a6040967d8dd32b6cdeceb907ca4d50f56e4c2.tar.gz
rneovim-d5a6040967d8dd32b6cdeceb907ca4d50f56e4c2.tar.bz2
rneovim-d5a6040967d8dd32b6cdeceb907ca4d50f56e4c2.zip
vim-patch:9.1.0598: fuzzy completion does not work with default completion
Problem: fuzzy completion does not work with default completion Solution: Make it work (glepnir) closes: vim/vim#15193 https://github.com/vim/vim/commit/8159fb18a92e9a9f5e35201bd92bf651f4d5835c Cherry-pick insexpand.c changes from patch 9.1.0608. N/A patch: vim-patch:9.1.0632: MS-Windows: Compiler Warnings Co-authored-by: glepnir <glephunter@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/functional/ui/popupmenu_spec.lua8
-rw-r--r--test/old/testdir/test_ins_complete.vim63
2 files changed, 67 insertions, 4 deletions
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua
index 728f8ed3d0..e41df13088 100644
--- a/test/functional/ui/popupmenu_spec.lua
+++ b/test/functional/ui/popupmenu_spec.lua
@@ -6938,9 +6938,9 @@ describe('builtin popupmenu', function()
feed('S hello helio hero h<C-X><C-P>')
screen:expect([[
hello helio hero h^ |
- {1:~ }{n: }{mn:h}{n:ello }{1: }|
+ {1:~ }{n: }{mn:h}{n:ero }{1: }|
{1:~ }{n: }{mn:h}{n:elio }{1: }|
- {1:~ }{s: }{ms:h}{s:ero }{1: }|
+ {1:~ }{s: }{ms:h}{s:ello }{1: }|
{1:~ }|*15
{2:-- }{5:match 1 of 3} |
]])
@@ -6948,9 +6948,9 @@ describe('builtin popupmenu', function()
feed('<Esc>S hello helio hero h<C-X><C-P><C-P>')
screen:expect([[
hello helio hero h^ |
- {1:~ }{n: }{mn:h}{n:ello }{1: }|
- {1:~ }{s: }{ms:h}{s:elio }{1: }|
{1:~ }{n: }{mn:h}{n:ero }{1: }|
+ {1:~ }{s: }{ms:h}{s:elio }{1: }|
+ {1:~ }{n: }{mn:h}{n:ello }{1: }|
{1:~ }|*15
{2:-- }{5:match 2 of 3} |
]])
diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim
index a08d0bd252..9b123a65b6 100644
--- a/test/old/testdir/test_ins_complete.vim
+++ b/test/old/testdir/test_ins_complete.vim
@@ -2832,6 +2832,68 @@ func Test_complete_fuzzy_match()
call feedkeys("A\<C-X>\<C-N>\<Esc>0", 'tx!')
call assert_equal('hello help hero h', getline('.'))
+ set completeopt-=noinsert
+ call setline(1, ['xyz yxz x'])
+ call feedkeys("A\<C-X>\<C-N>\<Esc>0", 'tx!')
+ call assert_equal('xyz yxz xyz', getline('.'))
+ " can fuzzy get yxz when use Ctrl-N twice
+ call setline(1, ['xyz yxz x'])
+ call feedkeys("A\<C-X>\<C-N>\<C-N>\<Esc>0", 'tx!')
+ call assert_equal('xyz yxz yxz', getline('.'))
+
+ call setline(1, ['你好 你'])
+ call feedkeys("A\<C-X>\<C-N>\<Esc>0", 'tx!')
+ call assert_equal('你好 你好', getline('.'))
+ call setline(1, ['你的 我的 的'])
+ call feedkeys("A\<C-X>\<C-N>\<Esc>0", 'tx!')
+ call assert_equal('你的 我的 你的', getline('.'))
+ " can fuzzy get multiple-byte word when use Ctrl-N twice
+ call setline(1, ['你的 我的 的'])
+ call feedkeys("A\<C-X>\<C-N>\<C-N>\<Esc>0", 'tx!')
+ call assert_equal('你的 我的 我的', getline('.'))
+
+ " respect wrapscan
+ set nowrapscan
+ call setline(1, ["xyz", "yxz", ""])
+ call cursor(3, 1)
+ call feedkeys("Sy\<C-X>\<C-N>\<Esc>0", 'tx!')
+ call assert_equal('y', getline('.'))
+ set wrapscan
+ call feedkeys("Sy\<C-X>\<C-N>\<Esc>0", 'tx!')
+ call assert_equal('xyz', getline('.'))
+
+ " fuzzy on file
+ call writefile([''], 'fobar', 'D')
+ call writefile([''], 'foobar', 'D')
+ call setline(1, ['fob'])
+ call cursor(1, 1)
+ call feedkeys("A\<C-X>\<C-f>\<Esc>0", 'tx!')
+ call assert_equal('fobar', getline('.'))
+ call feedkeys("Sfob\<C-X>\<C-f>\<C-N>\<Esc>0", 'tx!')
+ call assert_equal('foobar', getline('.'))
+
+ " can get completion from other buffer
+ set completeopt=fuzzy,menu,menuone
+ vnew
+ call setline(1, ["completeness,", "compatibility", "Composite", "Omnipotent"])
+ wincmd p
+ call feedkeys("Somp\<C-N>\<Esc>0", 'tx!')
+ call assert_equal('completeness', getline('.'))
+ call feedkeys("Somp\<C-N>\<C-N>\<Esc>0", 'tx!')
+ call assert_equal('compatibility', getline('.'))
+ call feedkeys("Somp\<C-P>\<Esc>0", 'tx!')
+ call assert_equal('Omnipotent', getline('.'))
+ call feedkeys("Somp\<C-P>\<C-P>\<Esc>0", 'tx!')
+ call assert_equal('Composite', getline('.'))
+
+ " fuzzy on whole line completion
+ call setline(1, ["world is on fire", "no one can save me but you", 'user can execute', ''])
+ call cursor(4, 1)
+ call feedkeys("Swio\<C-X>\<C-L>\<Esc>0", 'tx!')
+ call assert_equal('world is on fire', getline('.'))
+ call feedkeys("Su\<C-X>\<C-L>\<C-P>\<Esc>0", 'tx!')
+ call assert_equal('no one can save me but you', getline('.'))
+
" issue #15526
set completeopt=fuzzy,menuone,menu,noselect
call setline(1, ['Text', 'ToText', ''])
@@ -2884,6 +2946,7 @@ func Test_complete_fuzzy_match()
" clean up
set omnifunc=
bw!
+ bw!
set complete& completeopt&
autocmd! AAAAA_Group
augroup! AAAAA_Group