aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/ui/popupmenu_spec.lua88
-rw-r--r--test/old/testdir/test_cmdline.vim31
-rw-r--r--test/old/testdir/test_popup.vim21
3 files changed, 140 insertions, 0 deletions
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua
index 4ea60194c2..a1a21eb317 100644
--- a/test/functional/ui/popupmenu_spec.lua
+++ b/test/functional/ui/popupmenu_spec.lua
@@ -3550,6 +3550,66 @@ describe('builtin popupmenu', function()
|
]])
end)
+
+ -- oldtest: Test_wildmenu_pum_hl_match()
+ it('highlighting matched text in cmdline pum', function()
+ exec([[
+ set wildoptions=pum,fuzzy
+ hi PmenuMatchSel guifg=Blue guibg=Grey
+ hi PmenuMatch guifg=Blue guibg=Magenta
+ ]])
+
+ feed(':sign plc<Tab>')
+ screen:expect([[
+ |
+ {1:~ }|*16
+ {1:~ }{s: }{ms:pl}{s:a}{ms:c}{s:e }{1: }|
+ {1:~ }{n: un}{mn:pl}{n:a}{mn:c}{n:e }{1: }|
+ :sign place^ |
+ ]])
+ feed('<Tab>')
+ screen:expect([[
+ |
+ {1:~ }|*16
+ {1:~ }{n: }{mn:pl}{n:a}{mn:c}{n:e }{1: }|
+ {1:~ }{s: un}{ms:pl}{s:a}{ms:c}{s:e }{1: }|
+ :sign unplace^ |
+ ]])
+ feed('<Tab>')
+ screen:expect([[
+ |
+ {1:~ }|*16
+ {1:~ }{n: }{mn:pl}{n:a}{mn:c}{n:e }{1: }|
+ {1:~ }{n: un}{mn:pl}{n:a}{mn:c}{n:e }{1: }|
+ :sign plc^ |
+ ]])
+ feed('<Esc>')
+ command('set wildoptions-=fuzzy')
+ feed(':sign un<Tab>')
+ screen:expect([[
+ |
+ {1:~ }|*16
+ {1:~ }{s: }{ms:un}{s:define }{1: }|
+ {1:~ }{n: }{mn:un}{n:place }{1: }|
+ :sign undefine^ |
+ ]])
+ feed('<Tab>')
+ screen:expect([[
+ |
+ {1:~ }|*16
+ {1:~ }{n: }{mn:un}{n:define }{1: }|
+ {1:~ }{s: }{ms:un}{s:place }{1: }|
+ :sign unplace^ |
+ ]])
+ feed('<Tab>')
+ screen:expect([[
+ |
+ {1:~ }|*16
+ {1:~ }{n: }{mn:un}{n:define }{1: }|
+ {1:~ }{n: }{mn:un}{n:place }{1: }|
+ :sign un^ |
+ ]])
+ end)
end
it("'pumheight'", function()
@@ -4679,6 +4739,20 @@ describe('builtin popupmenu', function()
\ { 'word': '你可好吗' },
\]}
endfunc
+
+ func Comp()
+ let col = col('.')
+ if getline('.') == 'f'
+ let col -= 1
+ endif
+ call complete(col, [
+ \ #{word: "foo", icase: 1},
+ \ #{word: "Foobar", icase: 1},
+ \ #{word: "fooBaz", icase: 1},
+ \])
+ return ''
+ endfunc
+
set omnifunc=Omni_test
set completeopt=menu,noinsert,fuzzy
hi PmenuMatchSel guifg=Blue guibg=Grey
@@ -4818,6 +4892,20 @@ describe('builtin popupmenu', function()
]])
feed('<C-E><Esc>')
command('set norightleft')
+
+ feed('S<C-R>=Comp()<CR>f')
+ screen:expect([[
+ f^ |
+ {ms:f}{s:oo }{1: }|
+ {mn:F}{n:oobar }{1: }|
+ {mn:f}{n:ooBaz }{1: }|
+ {1:~ }|*15
+ {2:-- INSERT --} |
+ ]])
+ feed('o<BS><C-R>=Comp()<CR>')
+ screen:expect_unchanged(true)
+
+ feed('<C-E><Esc>')
end)
end
end
diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim
index f83f782817..4a637552a6 100644
--- a/test/old/testdir/test_cmdline.vim
+++ b/test/old/testdir/test_cmdline.vim
@@ -2923,6 +2923,37 @@ func Test_wildmenu_pum_rightleft()
call StopVimInTerminal(buf)
endfunc
+" Test highlighting matched text in cmdline completion popup menu.
+func Test_wildmenu_pum_hl_match()
+ CheckScreendump
+
+ let lines =<< trim END
+ set wildoptions=pum,fuzzy
+ hi PmenuMatchSel ctermfg=6 ctermbg=7
+ hi PmenuMatch ctermfg=4 ctermbg=225
+ END
+ call writefile(lines, 'Xwildmenu_pum_hl', 'D')
+ let buf = RunVimInTerminal('-S Xwildmenu_pum_hl', #{rows: 10, cols: 50})
+
+ call term_sendkeys(buf, ":sign plc\<Tab>")
+ call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_1', {})
+ call term_sendkeys(buf, "\<Tab>")
+ call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_2', {})
+ call term_sendkeys(buf, "\<Tab>")
+ call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_3', {})
+ call term_sendkeys(buf, "\<Esc>:set wildoptions-=fuzzy\<CR>")
+ call TermWait(buf)
+ call term_sendkeys(buf, ":sign un\<Tab>")
+ call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_4', {})
+ call term_sendkeys(buf, "\<Tab>")
+ call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_5', {})
+ call term_sendkeys(buf, "\<Tab>")
+ call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_6', {})
+ 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()
diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim
index 6c14fb3a6e..bfd81ad0a9 100644
--- a/test/old/testdir/test_popup.vim
+++ b/test/old/testdir/test_popup.vim
@@ -1407,6 +1407,20 @@ func Test_pum_highlights_match()
\ { 'word': '你可好吗' },
\]}
endfunc
+
+ func Comp()
+ let col = col('.')
+ if getline('.') == 'f'
+ let col -= 1
+ endif
+ call complete(col, [
+ \ #{word: "foo", icase: 1},
+ \ #{word: "Foobar", icase: 1},
+ \ #{word: "fooBaz", icase: 1},
+ \])
+ return ''
+ endfunc
+
set omnifunc=Omni_test
set completeopt=menu,noinsert,fuzzy
hi PmenuMatchSel ctermfg=6 ctermbg=7
@@ -1470,7 +1484,14 @@ func Test_pum_highlights_match()
call term_sendkeys(buf, ":set norightleft\<CR>")
endif
+ call term_sendkeys(buf, "S\<C-R>=Comp()\<CR>f")
+ call VerifyScreenDump(buf, 'Test_pum_highlights_09', {})
+ call term_sendkeys(buf, "o\<BS>\<C-R>=Comp()\<CR>")
+ call VerifyScreenDump(buf, 'Test_pum_highlights_09', {})
+
+ call term_sendkeys(buf, "\<C-E>\<Esc>")
call TermWait(buf)
+
call StopVimInTerminal(buf)
endfunc