From 6a2f8958e832aebc20cf42d8ade4cb58fe33df9e Mon Sep 17 00:00:00 2001 From: glepnir Date: Thu, 3 Oct 2024 06:45:01 +0800 Subject: 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 --- test/old/testdir/test_popup.vim | 60 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) (limited to 'test/old') diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index 2a038d7da4..f9c6d2eedd 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1583,4 +1583,64 @@ func Test_pum_user_kind_hlgroup() call StopVimInTerminal(buf) endfunc +func Test_pum_completeitemalign() + CheckScreendump + let lines =<< trim END + 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 + command! -nargs=0 T1 set cia=abbr,kind,menu + command! -nargs=0 T2 set cia=abbr,menu,kind + command! -nargs=0 T3 set cia=kind,abbr,menu + command! -nargs=0 T4 set cia=kind,menu,abbr + command! -nargs=0 T5 set cia=menu,abbr,kind + command! -nargs=0 T6 set cia=menu,kind,abbr + command! -nargs=0 T7 set cia& + END + call writefile(lines, 'Xscript', 'D') + let buf = RunVimInTerminal('-S Xscript', {}) + call TermWait(buf) + + " T1 is default + call term_sendkeys(buf, ":T1\S\\") + call VerifyScreenDump(buf, 'Test_pum_completeitemalign_01', {}) + call term_sendkeys(buf, "\\") + + " T2 + call term_sendkeys(buf, ":T2\S\\") + call VerifyScreenDump(buf, 'Test_pum_completeitemalign_02', {}) + call term_sendkeys(buf, "\\") + + " T3 + call term_sendkeys(buf, ":T3\S\\") + call VerifyScreenDump(buf, 'Test_pum_completeitemalign_03', {}) + call term_sendkeys(buf, "\\") + + " T4 + call term_sendkeys(buf, ":T4\S\\") + call VerifyScreenDump(buf, 'Test_pum_completeitemalign_04', {}) + call term_sendkeys(buf, "\\") + + " T5 + call term_sendkeys(buf, ":T5\S\\") + call VerifyScreenDump(buf, 'Test_pum_completeitemalign_05', {}) + call term_sendkeys(buf, "\\") + + " T6 + call term_sendkeys(buf, ":T6\S\\") + call VerifyScreenDump(buf, 'Test_pum_completeitemalign_06', {}) + call term_sendkeys(buf, "\\:T7\") + + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit