summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_popup.vim
diff options
context:
space:
mode:
authorGianmaria Bajo <mg1979.git@gmail.com>2023-03-10 16:35:53 +0000
committerBram Moolenaar <Bram@vim.org>2023-03-10 16:35:53 +0000
commit6a7c7749204b256e779c245b1e999bf852ad7b64 (patch)
tree4c71d0f915d2bb3df31acb34f4178de49a94b575 /src/testdir/test_popup.vim
parentbe19d78c3d44221cbc38fbb5bac19302345c1def (diff)
patch 9.0.1397: highlight for popupmenu kind and extra cannot be setv9.0.1397
Problem: Highlight for popupmenu kind and extra cannot be set. Solution: Add PmenuKind, PmenuKindSel, PmenuExtra and PmenuExtraSel highlight groups and use them. (Gianmaria Bajo, closes #12114)
Diffstat (limited to 'src/testdir/test_popup.vim')
-rw-r--r--src/testdir/test_popup.vim62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index 1401e5558c..1b091e3381 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -1250,4 +1250,66 @@ func Test_pum_scrollbar()
call StopVimInTerminal(buf)
endfunc
+" Test default highlight groups for popup menu
+func Test_pum_highlights_default()
+ CheckScreendump
+ let lines =<< trim END
+ func CompleteFunc( findstart, base )
+ if a:findstart
+ return 0
+ endif
+ return {
+ \ 'words': [
+ \ { 'word': 'aword1', 'menu': 'extra text 1', 'kind': 'W', },
+ \ { 'word': 'aword2', 'menu': 'extra text 2', 'kind': 'W', },
+ \ { 'word': 'aword3', 'menu': 'extra text 3', 'kind': 'W', },
+ \]}
+ endfunc
+ set completeopt=menu
+ set completefunc=CompleteFunc
+ END
+ call writefile(lines, 'Xscript', 'D')
+ let buf = RunVimInTerminal('-S Xscript', {})
+ call TermWait(buf)
+ call term_sendkeys(buf, "iaw\<C-X>\<C-u>")
+ call TermWait(buf, 50)
+ call VerifyScreenDump(buf, 'Test_pum_highlights_01', {})
+ call term_sendkeys(buf, "\<C-E>\<Esc>u")
+ call TermWait(buf)
+ call StopVimInTerminal(buf)
+endfunc
+
+" Test custom highlight groups for popup menu
+func Test_pum_highlights_custom()
+ CheckScreendump
+ let lines =<< trim END
+ func CompleteFunc( findstart, base )
+ if a:findstart
+ return 0
+ endif
+ return {
+ \ 'words': [
+ \ { 'word': 'aword1', 'menu': 'extra text 1', 'kind': 'W', },
+ \ { 'word': 'aword2', 'menu': 'extra text 2', 'kind': 'W', },
+ \ { 'word': 'aword3', 'menu': 'extra text 3', 'kind': 'W', },
+ \]}
+ endfunc
+ set completeopt=menu
+ set completefunc=CompleteFunc
+ hi PmenuKind ctermfg=1 ctermbg=225
+ hi PmenuKindSel ctermfg=1 ctermbg=7
+ hi PmenuExtra ctermfg=243 ctermbg=225
+ hi PmenuExtraSel ctermfg=0 ctermbg=7
+ END
+ call writefile(lines, 'Xscript', 'D')
+ let buf = RunVimInTerminal('-S Xscript', {})
+ call TermWait(buf)
+ call term_sendkeys(buf, "iaw\<C-X>\<C-u>")
+ call TermWait(buf, 50)
+ call VerifyScreenDump(buf, 'Test_pum_highlights_02', {})
+ call term_sendkeys(buf, "\<C-E>\<Esc>u")
+ call TermWait(buf)
+ call StopVimInTerminal(buf)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab