From cc300e553b458e08c4b1d4be117ee51a289cbdee Mon Sep 17 00:00:00 2001 From: glepnir Date: Thu, 3 Oct 2024 17:58:15 +0800 Subject: vim-patch:9.1.0756: missing change from patch v9.1.0754 (#30636) Problem: missing change from patch v9.1.0754 Solution: use correct width for the actual item in pum_redraw() (glepnir) closes: vim/vim#15786 https://github.com/vim/vim/commit/a6d9e3c4e07f73f6523699961d8b7b54bdb80cf6 --- test/functional/ui/popupmenu_spec.lua | 25 +++++++++++++++++++++++++ test/old/testdir/test_popup.vim | 16 +++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index e2f7e31c6c..f84362ede8 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -5077,6 +5077,17 @@ describe('builtin popupmenu', function() \ { 'word': '你好', 'kind': 'C', 'menu': '中文' }, \]} endfunc + + func Omni_long(findstart, base) + if a:findstart + return col(".") + endif + return { + \ 'words': [ + \ { 'word': 'loooong_foo', 'kind': 'S', 'menu': 'menu' }, + \ { 'word': 'loooong_bar', 'kind': 'T', 'menu': 'menu' }, + \]} + endfunc set omnifunc=Omni_test ]]) -- T1 @@ -5162,6 +5173,20 @@ describe('builtin popupmenu', function() {1:~ }|*10 {2:-- }{5:match 1 of 3} | ]]) + feed('') + + -- Test_pum_completeitemalign_07 + command('set cia=menu,kind,abbr columns=12 cmdheight=2 omnifunc=Omni_long') + feed('S') + screen:expect([[ + loooong_foo^ | + {s:menu S loooo}| + {n:menu T loooo}| + {1:~ }|*10 + | + {2:--} | + ]]) + feed('') end) end end diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index f9c6d2eedd..472882fb87 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1597,6 +1597,17 @@ func Test_pum_completeitemalign() \ { 'word': '你好', 'kind': 'C', 'menu': '中文' }, \]} endfunc + + func Omni_long(findstart, base) + if a:findstart + return col(".") + endif + return { + \ 'words': [ + \ { 'word': 'loooong_foo', 'kind': 'S', 'menu': 'menu' }, + \ { 'word': 'loooong_bar', 'kind': 'T', 'menu': 'menu' }, + \]} + endfunc set omnifunc=Omni_test command! -nargs=0 T1 set cia=abbr,kind,menu command! -nargs=0 T2 set cia=abbr,menu,kind @@ -1638,8 +1649,11 @@ func Test_pum_completeitemalign() " T6 call term_sendkeys(buf, ":T6\S\\") call VerifyScreenDump(buf, 'Test_pum_completeitemalign_06', {}) - call term_sendkeys(buf, "\\:T7\") + call term_sendkeys(buf, "\\") + call term_sendkeys(buf, ":set columns=12 cmdheight=2 omnifunc=Omni_long\S\\") + call VerifyScreenDump(buf, 'Test_pum_completeitemalign_07', {}) + call term_sendkeys(buf, "\\:T7\") call StopVimInTerminal(buf) endfunc -- cgit