diff options
Diffstat (limited to 'src/testdir/test_popup.vim')
-rw-r--r-- | src/testdir/test_popup.vim | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim index dd01a57..fe958da 100644 --- a/src/testdir/test_popup.vim +++ b/src/testdir/test_popup.vim @@ -1482,8 +1482,101 @@ func Test_pum_highlights_match() call term_sendkeys(buf, "o\<BS>\<C-R>=Comp()\<CR>") call VerifyScreenDump(buf, 'Test_pum_highlights_09', {}) + " issue #15095 wrong select + call term_sendkeys(buf, "\<ESC>:set completeopt=fuzzy,menu\<CR>") + call TermWait(buf) + call term_sendkeys(buf, "S hello helio hero h\<C-X>\<C-P>") + call TermWait(buf, 50) + call VerifyScreenDump(buf, 'Test_pum_highlights_10', {}) + + call term_sendkeys(buf, "\<ESC>S hello helio hero h\<C-X>\<C-P>\<C-P>") + call TermWait(buf, 50) + call VerifyScreenDump(buf, 'Test_pum_highlights_11', {}) + + " issue #15357 + call term_sendkeys(buf, "\<ESC>S/non_exit_folder\<C-X>\<C-F>") + call TermWait(buf, 50) + call VerifyScreenDump(buf, 'Test_pum_highlights_15', {}) + + call term_sendkeys(buf, "\<C-E>\<Esc>") + call TermWait(buf) + + call StopVimInTerminal(buf) +endfunc + +func Test_pum_user_hl_group() + 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', 'hl_group': 'StrikeFake' }, + \ { 'word': 'aword2', 'menu': 'extra text 2', 'kind': 'W', }, + \ { 'word': '你好', 'menu': 'extra text 3', 'kind': 'W', 'hl_group': 'StrikeFake' }, + \]} + 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, "Saw\<C-X>\<C-U>") + call VerifyScreenDump(buf, 'Test_pum_highlights_12', {}) + call term_sendkeys(buf, "\<C-E>\<Esc>") + + call TermWait(buf) + call term_sendkeys(buf, ":call HlMatch()\<CR>") + + call TermWait(buf) + call term_sendkeys(buf, "Saw\<C-X>\<C-U>") + call VerifyScreenDump(buf, 'Test_pum_highlights_13', {}) + call term_sendkeys(buf, "\<C-N>") + call VerifyScreenDump(buf, 'Test_pum_highlights_14', {}) call term_sendkeys(buf, "\<C-E>\<Esc>") + + call StopVimInTerminal(buf) +endfunc + +func Test_pum_user_kind_hlgroup() + CheckScreendump + let lines =<< trim END + func CompleteFunc( findstart, base ) + if a:findstart + return 0 + endif + return { + \ 'words': [ + \ { 'word': 'aword1', 'menu': 'extra text 1', 'kind': 'variable', 'kind_hlgroup': 'KindVar', 'hl_group': 'StrikeFake' }, + \ { 'word': 'aword2', 'menu': 'extra text 2', 'kind': 'function', 'kind_hlgroup': 'KindFunc' }, + \ { 'word': '你好', 'menu': 'extra text 3', 'kind': 'class', 'kind_hlgroup': 'KindClass' }, + \]} + endfunc + set completeopt=menu + set completefunc=CompleteFunc + + hi StrikeFake ctermfg=9 + hi KindVar ctermfg=yellow + hi KindFunc ctermfg=blue + hi KindClass ctermfg=green + END + call writefile(lines, 'Xscript', 'D') + let buf = RunVimInTerminal('-S Xscript', {}) + call TermWait(buf) + call term_sendkeys(buf, "S\<C-X>\<C-U>") + call VerifyScreenDump(buf, 'Test_pum_highlights_16', {}) + call term_sendkeys(buf, "\<C-E>\<Esc>") call StopVimInTerminal(buf) endfunc |