From b8b0e9db3f91fbaa8835b90c683c33310064c8c8 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 27 Jul 2024 21:44:05 +0800 Subject: vim-patch:9.1.0629: Rename of pum hl_group is incomplete Problem: Rename of pum hl_group is incomplete in source. Solution: Also rename the test function. Rename to user_hlattr in code to avoid confusion with pum_extra. Add test with matched text highlighting (zeertzjq). closes: vim/vim#15348 https://github.com/vim/vim/commit/4100852e099133a0c9603e1087e5dc6d82001ce7 --- test/functional/ui/popupmenu_spec.lua | 55 +++++++++++++++++++++++++++++++++-- test/old/testdir/test_popup.vim | 25 ++++++++++++---- 2 files changed, 72 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index 26110b559d..c73d5bf97a 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -1181,6 +1181,26 @@ describe('builtin popupmenu', function() mn = { foreground = Screen.colors.Blue, background = Screen.colors.Plum1 }, ds = { foreground = Screen.colors.DarkRed, background = Screen.colors.Grey }, dn = { foreground = Screen.colors.DarkRed, background = Screen.colors.Plum1 }, + ums = { + foreground = Screen.colors.Blue, + background = Screen.colors.Grey, + underline = true, + }, + umn = { + foreground = Screen.colors.Blue, + background = Screen.colors.Plum1, + underline = true, + }, + uds = { + foreground = Screen.colors.DarkRed, + background = Screen.colors.Grey, + underline = true, + }, + udn = { + foreground = Screen.colors.DarkRed, + background = Screen.colors.Plum1, + underline = true, + }, }) screen:attach({ ext_multigrid = multigrid }) end) @@ -4934,10 +4954,9 @@ describe('builtin popupmenu', function() feed('') end) - -- oldtest: Test_pum_extrahl() + -- oldtest: Test_pum_user_hl_group() it('custom hl_group override', function() exec([[ - hi StrikeFake guifg=DarkRed func CompleteFunc( findstart, base ) if a:findstart return 0 @@ -4951,8 +4970,15 @@ describe('builtin popupmenu', function() endfunc set completeopt=menu set completefunc=CompleteFunc + + hi StrikeFake guifg=DarkRed + func HlMatch() + hi PmenuMatchSel guifg=Blue guibg=Grey gui=underline + hi PmenuMatch guifg=Blue guibg=Plum1 gui=underline + endfunc ]]) - feed('iaw') + + feed('Saw') screen:expect([[ aword1^ | {ds:aword1 W extra text 1 }{1: }| @@ -4961,6 +4987,29 @@ describe('builtin popupmenu', function() {1:~ }|*15 {2:-- }{5:match 1 of 3} | ]]) + feed('') + + command('call HlMatch()') + + feed('Saw') + screen:expect([[ + aword1^ | + {uds:aw}{ds:ord1 W extra text 1 }{1: }| + {umn:aw}{n:ord2 W extra text 2 }{1: }| + {dn:你好 W extra text 3 }{1: }| + {1:~ }|*15 + {2:-- }{5:match 1 of 3} | + ]]) + feed('') + screen:expect([[ + aword2^ | + {udn:aw}{dn:ord1 W extra text 1 }{1: }| + {ums:aw}{s:ord2 W extra text 2 }{1: }| + {dn:你好 W extra text 3 }{1: }| + {1:~ }|*15 + {2:-- }{5:match 2 of 3} | + ]]) + feed('') end) end end diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index 1bba1d9397..5e234a397b 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1506,10 +1506,9 @@ func Test_pum_highlights_match() call StopVimInTerminal(buf) endfunc -func Test_pum_extrahl() +func Test_pum_user_hl_group() CheckScreendump let lines =<< trim END - hi StrikeFake ctermfg=9 func CompleteFunc( findstart, base ) if a:findstart return 0 @@ -1523,15 +1522,31 @@ func Test_pum_extrahl() endfunc set completeopt=menu set completefunc=CompleteFunc + + hi StrikeFake ctermfg=9 + func HlMatch() + hi PmenuMatchSel ctermfg=6 ctermbg=7 cterm=underline + hi PmenuMatch ctermfg=4 ctermbg=225 cterm=underline + endfunc END call writefile(lines, 'Xscript', 'D') let buf = RunVimInTerminal('-S Xscript', {}) + call TermWait(buf) - call term_sendkeys(buf, "iaw\\") - call TermWait(buf, 50) + call term_sendkeys(buf, "Saw\\") call VerifyScreenDump(buf, 'Test_pum_highlights_12', {}) - call term_sendkeys(buf, "\\u") + call term_sendkeys(buf, "\\") + call TermWait(buf) + call term_sendkeys(buf, ":call HlMatch()\") + + call TermWait(buf) + call term_sendkeys(buf, "Saw\\") + call VerifyScreenDump(buf, 'Test_pum_highlights_13', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_pum_highlights_14', {}) + call term_sendkeys(buf, "\\") + call StopVimInTerminal(buf) endfunc -- cgit