call StopVimInTerminal(buf)
endfunc
+" Test highlighting of matched text in cmdline completion popup menu provided
+" by a command completed with customlist.
+func Test_wildmenu_pum_hl_match_list()
+ CheckScreendump
+
+ let lines =<< trim END
+ set wildoptions=pum,fuzzy
+ hi PmenuMatchSel cterm=reverse
+ hi PmenuMatch cterm=reverse
+ command -nargs=1 -complete=customlist,ListComplete ListT echo <q-args>
+ func ListComplete(A, B, C)
+ return ['hello/world', 'hello/wonderful']->matchfuzzy(a:A)
+ endfunc
+ END
+ call writefile(lines, 'Xwildmenu_pum_hl', 'D')
+ let buf = RunVimInTerminal('-S Xwildmenu_pum_hl', #{rows: 10, cols: 50})
+
+ call term_sendkeys(buf, ":ListT hewo\<Tab>")
+ call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_list_1', {})
+ call term_sendkeys(buf, "\<Esc>:set wildoptions-=fuzzy\<CR>")
+ call TermWait(buf)
+ call term_sendkeys(buf, ":ListT hewo\<Tab>")
+ call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_list_2', {})
+ call term_sendkeys(buf, "\<Esc>")
+
+ call StopVimInTerminal(buf)
+endfunc
+
+" Test highlighting of matched text in cmdline completion popup menu provided
+" by a custom 'findfunc'
+func Test_wildmenu_pum_hl_match_findfunc()
+ CheckScreendump
+
+ let lines =<< trim END
+ set wildoptions=pum,fuzzy
+ hi PmenuMatchSel cterm=reverse
+ hi PmenuMatch cterm=reverse
+ func FindComplete(cmdarg, cmdcomplete)
+ return ['hello/world', 'hello/wonderful']->matchfuzzy(a:cmdarg)
+ endfunc
+ set findfunc=FindComplete
+ END
+ call writefile(lines, 'Xwildmenu_pum_hl', 'D')
+ let buf = RunVimInTerminal('-S Xwildmenu_pum_hl', #{rows: 10, cols: 50})
+
+ call term_sendkeys(buf, ":find hewo\<Tab>")
+ call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_find_1', {})
+ call term_sendkeys(buf, "\<Esc>:set wildoptions-=fuzzy\<CR>")
+ call TermWait(buf)
+ call term_sendkeys(buf, ":find hewo\<Tab>")
+ call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_find_2', {})
+ call term_sendkeys(buf, "\<Esc>")
+
+ call StopVimInTerminal(buf)
+endfunc
+
" Test for completion after a :substitute command followed by a pipe (|)
" character
func Test_cmdline_complete_substitute()