aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/ui/popupmenu_spec.lua23
-rw-r--r--test/old/testdir/test_cmdline.vim22
2 files changed, 45 insertions, 0 deletions
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua
index f6c9236037..0206900c06 100644
--- a/test/functional/ui/popupmenu_spec.lua
+++ b/test/functional/ui/popupmenu_spec.lua
@@ -5145,6 +5145,29 @@ describe('builtin popupmenu', function()
]])
end)
+ -- oldtest: Test_wildmenu_pum_hl_nonfirst()
+ it('highlight matched text in the middle in cmdline pum', function()
+ exec([[
+ set wildoptions=pum wildchar=<tab> wildmode=noselect,full
+ hi PmenuMatchSel guifg=Blue guibg=Grey
+ hi PmenuMatch guifg=Blue guibg=Plum1
+ func T(a, c, p)
+ return ["oneA", "o neBneB", "aoneC"]
+ endfunc
+ command -nargs=1 -complete=customlist,T MyCmd
+ ]])
+
+ feed(':MyCmd ne<tab>')
+ screen:expect([[
+ |
+ {1:~ }|*15
+ {1:~ }{n: o}{mn:ne}{n:A }{1: }|
+ {1:~ }{n: o }{mn:ne}{n:BneB }{1: }|
+ {1:~ }{n: ao}{mn:ne}{n:C }{1: }|
+ :MyCmd ne^ |
+ ]])
+ end)
+
it(
'cascading highlights for matched text (PmenuMatch, PmenuMatchSel) in cmdline pum',
function()
diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim
index d9496ba2a6..639a4c1d32 100644
--- a/test/old/testdir/test_cmdline.vim
+++ b/test/old/testdir/test_cmdline.vim
@@ -3025,6 +3025,28 @@ func Test_wildmenu_pum_rightleft()
call StopVimInTerminal(buf)
endfunc
+" Test highlighting when pattern matches non-first character of item
+func Test_wildmenu_pum_hl_nonfirst()
+ CheckScreendump
+ let lines =<< trim END
+ set wildoptions=pum wildchar=<tab> wildmode=noselect,full
+ hi PmenuMatchSel ctermfg=6 ctermbg=7
+ hi PmenuMatch ctermfg=4 ctermbg=225
+ func T(a, c, p)
+ return ["oneA", "o neBneB", "aoneC"]
+ endfunc
+ command -nargs=1 -complete=customlist,T MyCmd
+ END
+
+ call writefile(lines, 'Xwildmenu_pum_hl_nonf', 'D')
+ let buf = RunVimInTerminal('-S Xwildmenu_pum_hl_nonf', #{rows: 10, cols: 50})
+
+ call term_sendkeys(buf, ":MyCmd ne\<tab>")
+ call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_nonf', {})
+ call term_sendkeys(buf, "\<Esc>")
+ call StopVimInTerminal(buf)
+endfunc
+
" Test highlighting matched text in cmdline completion popup menu.
func Test_wildmenu_pum_hl_match()
CheckScreendump