aboutsummaryrefslogtreecommitdiff
path: root/test/old/testdir
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-03-11 10:05:47 +0800
committerGitHub <noreply@github.com>2023-03-11 10:05:47 +0800
commit8cb5b995b6e4d86035e6950d92c0c68ab4e46787 (patch)
treef82e021bea111cc4ad18a16c52f72efcde1e6c8b /test/old/testdir
parent29a43ef8affbb9ecbae03b75db346205ffe9ec14 (diff)
downloadrneovim-8cb5b995b6e4d86035e6950d92c0c68ab4e46787.tar.gz
rneovim-8cb5b995b6e4d86035e6950d92c0c68ab4e46787.tar.bz2
rneovim-8cb5b995b6e4d86035e6950d92c0c68ab4e46787.zip
vim-patch:9.0.1397: highlight for popupmenu kind and extra cannot be set (#22619)
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 vim/vim#12114) https://github.com/vim/vim/commit/6a7c7749204b256e779c245b1e999bf852ad7b64 Co-authored-by: Gianmaria Bajo <mg1979.git@gmail.com>
Diffstat (limited to 'test/old/testdir')
-rw-r--r--test/old/testdir/test_popup.vim62
1 files changed, 62 insertions, 0 deletions
diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim
index 791cce4431..2cc676fb6d 100644
--- a/test/old/testdir/test_popup.vim
+++ b/test/old/testdir/test_popup.vim
@@ -1260,4 +1260,66 @@ func Test_pum_scrollbar()
call delete('Xtest1')
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