aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/popupmenu_spec.lua
diff options
context:
space:
mode:
authorglepnir <glephunter@gmail.com>2024-10-03 06:45:01 +0800
committerGitHub <noreply@github.com>2024-10-03 06:45:01 +0800
commit6a2f8958e832aebc20cf42d8ade4cb58fe33df9e (patch)
treee2d5750f75a126a32cc7128ab9c5d1e869b5437a /test/functional/ui/popupmenu_spec.lua
parentd3b4772ddcd4c890dc5bc38e1f1b36a08aed0c04 (diff)
downloadrneovim-6a2f8958e832aebc20cf42d8ade4cb58fe33df9e.tar.gz
rneovim-6a2f8958e832aebc20cf42d8ade4cb58fe33df9e.tar.bz2
rneovim-6a2f8958e832aebc20cf42d8ade4cb58fe33df9e.zip
vim-patch:9.1.0754: fixed order of items in insert-mode completion menu (#30619)
Problem: fixed order of items in insert-mode completion menu Solution: Introduce the 'completeitemalign' option with default value "abbr,kind,menu" (glepnir). Adding an new option `completeitemalign` abbr is `cia` to custom the complete-item order in popupmenu. closes: vim/vim#14006 closes: vim/vim#15760 https://github.com/vim/vim/commit/6a89c94a9eeee53481ced1a1260a177bffde4c0f
Diffstat (limited to 'test/functional/ui/popupmenu_spec.lua')
-rw-r--r--test/functional/ui/popupmenu_spec.lua102
1 files changed, 102 insertions, 0 deletions
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua
index 3acbd5d987..e2f7e31c6c 100644
--- a/test/functional/ui/popupmenu_spec.lua
+++ b/test/functional/ui/popupmenu_spec.lua
@@ -5061,6 +5061,108 @@ describe('builtin popupmenu', function()
]])
feed('<C-E><Esc>')
end)
+
+ -- oldtest: Test_pum_completeitemalign()
+ it('completeitemalign option', function()
+ screen:try_resize(30, 15)
+ exec([[
+ func Omni_test(findstart, base)
+ if a:findstart
+ return col(".")
+ endif
+ return {
+ \ 'words': [
+ \ { 'word': 'foo', 'kind': 'S', 'menu': 'menu' },
+ \ { 'word': 'bar', 'kind': 'T', 'menu': 'menu' },
+ \ { 'word': '你好', 'kind': 'C', 'menu': '中文' },
+ \]}
+ endfunc
+ set omnifunc=Omni_test
+ ]])
+ -- T1
+ command('set cia=abbr,kind,menu')
+ feed('S<C-X><C-O>')
+ screen:expect([[
+ foo^ |
+ {s:foo S menu }{1: }|
+ {n:bar T menu }{1: }|
+ {n:你好 C 中文 }{1: }|
+ {1:~ }|*10
+ {2:-- }{5:match 1 of 3} |
+ ]])
+ feed('<C-E><ESC>')
+ -- T2
+ command('set cia=abbr,menu,kind')
+ feed('S<C-X><C-O>')
+ screen:expect([[
+ foo^ |
+ {s:foo menu S }{1: }|
+ {n:bar menu T }{1: }|
+ {n:你好 中文 C }{1: }|
+ {1:~ }|*10
+ {2:-- }{5:match 1 of 3} |
+ ]])
+ feed('<C-E><ESC>')
+ -- T3
+ command('set cia=kind,abbr,menu')
+ feed('S<C-X><C-O>')
+ screen:expect([[
+ foo^ |
+ {s:S foo menu }{1: }|
+ {n:T bar menu }{1: }|
+ {n:C 你好 中文 }{1: }|
+ {1:~ }|*10
+ {2:-- }{5:match 1 of 3} |
+ ]])
+ feed('<C-E><ESC>')
+ -- T4
+ command('set cia=kind,menu,abbr')
+ feed('S<C-X><C-O>')
+ screen:expect([[
+ foo^ |
+ {s:S menu foo }{1: }|
+ {n:T menu bar }{1: }|
+ {n:C 中文 你好 }{1: }|
+ {1:~ }|*10
+ {2:-- }{5:match 1 of 3} |
+ ]])
+ feed('<C-E><ESC>')
+ -- T5
+ command('set cia=menu,abbr,kind')
+ feed('S<C-X><C-O>')
+ screen:expect([[
+ foo^ |
+ {s:menu foo S }{1: }|
+ {n:menu bar T }{1: }|
+ {n:中文 你好 C }{1: }|
+ {1:~ }|*10
+ {2:-- }{5:match 1 of 3} |
+ ]])
+ feed('<C-E><ESC>')
+ -- T6
+ command('set cia=menu,kind,abbr')
+ feed('S<C-X><C-O>')
+ screen:expect([[
+ foo^ |
+ {s:menu S foo }{1: }|
+ {n:menu T bar }{1: }|
+ {n:中文 C 你好 }{1: }|
+ {1:~ }|*10
+ {2:-- }{5:match 1 of 3} |
+ ]])
+ feed('<C-E><ESC>')
+ -- T7
+ command('set cia&')
+ feed('S<C-X><C-O>')
+ screen:expect([[
+ foo^ |
+ {s:foo S menu }{1: }|
+ {n:bar T menu }{1: }|
+ {n:你好 C 中文 }{1: }|
+ {1:~ }|*10
+ {2:-- }{5:match 1 of 3} |
+ ]])
+ end)
end
end