2016-04-23 16:53:11 -07:00
|
|
|
local helpers = require('test.functional.helpers')(after_each)
|
2015-02-14 18:16:39 -07:00
|
|
|
local Screen = require('test.functional.ui.screen')
|
2017-04-08 14:12:26 -07:00
|
|
|
local clear, feed, command = helpers.clear, helpers.feed, helpers.command
|
2017-08-05 17:44:15 -07:00
|
|
|
local iswin = helpers.iswin
|
2016-05-01 12:47:10 -07:00
|
|
|
local funcs = helpers.funcs
|
2017-08-02 15:41:52 -07:00
|
|
|
local eq = helpers.eq
|
|
|
|
local eval = helpers.eval
|
|
|
|
local retry = helpers.retry
|
2019-08-09 14:31:53 -07:00
|
|
|
local nvim_dir = helpers.nvim_dir
|
2015-02-14 18:16:39 -07:00
|
|
|
|
2017-08-02 15:41:52 -07:00
|
|
|
describe("'wildmenu'", function()
|
2015-02-14 18:16:39 -07:00
|
|
|
local screen
|
|
|
|
before_each(function()
|
|
|
|
clear()
|
|
|
|
screen = Screen.new(25, 5)
|
|
|
|
screen:attach()
|
|
|
|
end)
|
|
|
|
|
2017-08-02 15:41:52 -07:00
|
|
|
it(':sign <tab> shows wildmenu completions', function()
|
2019-03-16 12:28:52 -07:00
|
|
|
command('set wildmenu wildmode=full')
|
2017-08-02 15:41:52 -07:00
|
|
|
feed(':sign <tab>')
|
|
|
|
screen:expect([[
|
|
|
|
|
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
define jump list > |
|
|
|
|
:sign define^ |
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
2018-06-01 15:22:53 -07:00
|
|
|
it(':sign <tab> <space> hides wildmenu #8453', function()
|
|
|
|
command('set wildmode=full')
|
|
|
|
-- only a regression if status-line open
|
|
|
|
command('set laststatus=2')
|
|
|
|
command('set wildmenu')
|
|
|
|
feed(':sign <tab>')
|
|
|
|
screen:expect([[
|
|
|
|
|
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
define jump list > |
|
|
|
|
:sign define^ |
|
|
|
|
]])
|
|
|
|
feed('<space>')
|
|
|
|
screen:expect([[
|
|
|
|
|
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
[No Name] |
|
|
|
|
:sign define ^ |
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
2017-08-02 15:41:52 -07:00
|
|
|
it('does not crash after cycling back to original text', function()
|
|
|
|
command('set wildmode=full')
|
|
|
|
feed(':j<Tab><Tab><Tab>')
|
|
|
|
screen:expect([[
|
|
|
|
|
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
join jumps |
|
|
|
|
:j^ |
|
|
|
|
]])
|
|
|
|
-- This would cause nvim to crash before #6650
|
|
|
|
feed('<BS><Tab>')
|
|
|
|
screen:expect([[
|
|
|
|
|
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
! # & < = > @ > |
|
|
|
|
:!^ |
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('is preserved during :terminal activity', function()
|
|
|
|
command('set wildmenu wildmode=full')
|
|
|
|
command('set scrollback=4')
|
2019-08-09 14:31:53 -07:00
|
|
|
feed([[:terminal "]]..nvim_dir..[[/shell-test" REP 5000 !terminal_output!<cr>]])
|
|
|
|
feed('G') -- Follow :terminal output.
|
2017-08-02 15:41:52 -07:00
|
|
|
feed([[:sign <Tab>]]) -- Invoke wildmenu.
|
2019-04-11 04:51:07 -07:00
|
|
|
-- NB: in earlier versions terminal output was redrawn during cmdline mode.
|
|
|
|
-- For now just assert that the screen remains unchanged.
|
2019-09-04 19:03:01 -07:00
|
|
|
screen:expect{any='define jump list > |\n:sign define^ |'}
|
2019-09-04 17:26:40 -07:00
|
|
|
screen:expect_unchanged()
|
2017-08-04 18:34:38 -07:00
|
|
|
|
|
|
|
-- cmdline CTRL-D display should also be preserved.
|
2019-09-02 05:47:25 -07:00
|
|
|
feed([[<C-U>]])
|
|
|
|
feed([[sign <C-D>]]) -- Invoke cmdline CTRL-D.
|
2019-09-04 19:03:01 -07:00
|
|
|
screen:expect{grid=[[
|
|
|
|
:sign |
|
|
|
|
define place |
|
|
|
|
jump undefine |
|
|
|
|
list unplace |
|
|
|
|
:sign ^ |
|
|
|
|
]]}
|
2019-09-04 17:26:40 -07:00
|
|
|
screen:expect_unchanged()
|
2017-08-04 18:34:38 -07:00
|
|
|
|
|
|
|
-- Exiting cmdline should show the buffer.
|
|
|
|
feed([[<C-\><C-N>]])
|
2019-08-09 14:31:53 -07:00
|
|
|
screen:expect{any=[[!terminal_output!]]}
|
2017-08-02 15:41:52 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('ignores :redrawstatus called from a timer #7108', function()
|
|
|
|
command('set wildmenu wildmode=full')
|
|
|
|
command([[call timer_start(10, {->execute('redrawstatus')}, {'repeat':-1})]])
|
|
|
|
feed([[<C-\><C-N>]])
|
|
|
|
feed([[:sign <Tab>]]) -- Invoke wildmenu.
|
2019-09-04 17:26:40 -07:00
|
|
|
screen:expect{grid=[[
|
2017-08-02 15:41:52 -07:00
|
|
|
|
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
define jump list > |
|
|
|
|
:sign define^ |
|
2017-06-26 05:49:15 -07:00
|
|
|
]]}
|
2019-09-04 17:26:40 -07:00
|
|
|
screen:expect_unchanged()
|
2017-08-02 15:41:52 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('with laststatus=0, :vsplit, :term #2255', function()
|
|
|
|
-- Because this test verifies a _lack_ of activity after screen:sleep(), we
|
|
|
|
-- must wait the full timeout. So make it reasonable.
|
|
|
|
screen.timeout = 1000
|
|
|
|
|
2017-08-05 17:44:15 -07:00
|
|
|
if not iswin() then
|
|
|
|
command('set shell=sh') -- Need a predictable "$" prompt.
|
2017-08-02 15:41:52 -07:00
|
|
|
end
|
|
|
|
command('set laststatus=0')
|
|
|
|
command('vsplit')
|
|
|
|
command('term')
|
|
|
|
|
|
|
|
-- Check for a shell prompt to verify that the terminal loaded.
|
|
|
|
retry(nil, nil, function()
|
|
|
|
if iswin() then
|
2017-08-05 17:44:15 -07:00
|
|
|
eq('Microsoft', eval("matchstr(join(getline(1, '$')), 'Microsoft')"))
|
2017-08-02 15:41:52 -07:00
|
|
|
else
|
|
|
|
eq('$', eval([[matchstr(getline(1), '\$')]]))
|
|
|
|
end
|
2017-05-03 01:12:38 -07:00
|
|
|
end)
|
2017-08-02 15:41:52 -07:00
|
|
|
|
|
|
|
feed([[<C-\><C-N>]])
|
|
|
|
feed([[:<Tab>]]) -- Invoke wildmenu.
|
|
|
|
-- Check only the last 2 lines, because the shell output is
|
|
|
|
-- system-dependent.
|
2019-09-04 17:26:40 -07:00
|
|
|
screen:expect{any='! # & < = > @ > |\n:!^'}
|
|
|
|
screen:expect_unchanged()
|
2015-02-14 18:16:39 -07:00
|
|
|
end)
|
2016-05-01 12:47:10 -07:00
|
|
|
|
2019-06-02 15:08:32 -07:00
|
|
|
it('wildmode=list,full and display+=msgsep interaction #10092', function()
|
|
|
|
-- Need more than 5 rows, else tabline is covered and will be redrawn.
|
2019-06-03 02:23:10 -07:00
|
|
|
screen:try_resize(25, 7)
|
2019-06-02 12:38:34 -07:00
|
|
|
|
|
|
|
command('set display+=msgsep')
|
|
|
|
command('set wildmenu wildmode=list,full')
|
|
|
|
command('set showtabline=2')
|
|
|
|
feed(':set wildm<tab>')
|
|
|
|
screen:expect([[
|
|
|
|
[No Name] |
|
|
|
|
|
|
|
|
|
~ |
|
|
|
|
|
|
|
|
|
:set wildm |
|
|
|
|
wildmenu wildmode |
|
|
|
|
:set wildm^ |
|
|
|
|
]])
|
|
|
|
feed('<tab>') -- trigger wildmode full
|
|
|
|
screen:expect([[
|
|
|
|
[No Name] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:set wildm |
|
|
|
|
wildmenu wildmode |
|
|
|
|
wildmenu wildmode |
|
|
|
|
:set wildmenu^ |
|
|
|
|
]])
|
|
|
|
feed('<Esc>')
|
|
|
|
screen:expect([[
|
|
|
|
[No Name] |
|
|
|
|
^ |
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
2019-06-02 15:08:32 -07:00
|
|
|
it('wildmode=list,full and display-=msgsep interaction', function()
|
|
|
|
-- Need more than 5 rows, else tabline is covered and will be redrawn.
|
2019-06-03 02:23:10 -07:00
|
|
|
screen:try_resize(25, 7)
|
2019-06-02 15:08:32 -07:00
|
|
|
|
2019-06-02 12:38:34 -07:00
|
|
|
command('set display-=msgsep')
|
|
|
|
command('set wildmenu wildmode=list,full')
|
|
|
|
feed(':set wildm<tab>')
|
|
|
|
screen:expect([[
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
:set wildm |
|
|
|
|
wildmenu wildmode |
|
|
|
|
:set wildm^ |
|
|
|
|
]])
|
|
|
|
feed('<tab>') -- trigger wildmode full
|
|
|
|
screen:expect([[
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
:set wildm |
|
|
|
|
wildmenu wildmode |
|
|
|
|
wildmenu wildmode |
|
|
|
|
:set wildmenu^ |
|
|
|
|
]])
|
|
|
|
feed('<Esc>')
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
2019-06-02 14:35:04 -07:00
|
|
|
|
|
|
|
it('multiple <C-D> renders correctly', function()
|
2019-06-03 02:23:10 -07:00
|
|
|
screen:try_resize(25, 7)
|
|
|
|
|
2019-06-02 14:35:04 -07:00
|
|
|
command('set laststatus=2')
|
|
|
|
command('set display+=msgsep')
|
|
|
|
feed(':set wildm')
|
|
|
|
feed('<c-d>')
|
|
|
|
screen:expect([[
|
|
|
|
|
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
|
|
|
|
|
:set wildm |
|
|
|
|
wildmenu wildmode |
|
|
|
|
:set wildm^ |
|
|
|
|
]])
|
|
|
|
feed('<c-d>')
|
|
|
|
screen:expect([[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:set wildm |
|
|
|
|
wildmenu wildmode |
|
|
|
|
:set wildm |
|
|
|
|
wildmenu wildmode |
|
|
|
|
:set wildm^ |
|
|
|
|
]])
|
|
|
|
feed('<Esc>')
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
[No Name] |
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
2019-06-02 12:38:34 -07:00
|
|
|
end)
|
|
|
|
|
2016-05-01 12:47:10 -07:00
|
|
|
describe('command line completion', function()
|
|
|
|
local screen
|
|
|
|
before_each(function()
|
|
|
|
screen = Screen.new(40, 5)
|
2019-03-03 02:33:27 -07:00
|
|
|
screen:set_default_attr_ids({
|
|
|
|
[1] = {bold = true, foreground = Screen.colors.Blue1},
|
|
|
|
[2] = {foreground = Screen.colors.Grey0, background = Screen.colors.Yellow},
|
|
|
|
[3] = {bold = true, reverse = true},
|
|
|
|
})
|
2016-05-01 12:47:10 -07:00
|
|
|
end)
|
|
|
|
after_each(function()
|
|
|
|
os.remove('Xtest-functional-viml-compl-dir')
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('lists directories with empty PATH', function()
|
2019-03-03 02:33:27 -07:00
|
|
|
clear()
|
|
|
|
screen:attach()
|
2016-05-01 12:47:10 -07:00
|
|
|
local tmp = funcs.tempname()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('e '.. tmp)
|
|
|
|
command('cd %:h')
|
|
|
|
command("call mkdir('Xtest-functional-viml-compl-dir')")
|
|
|
|
command('let $PATH=""')
|
2016-05-01 12:47:10 -07:00
|
|
|
feed(':!<tab><bs>')
|
|
|
|
screen:expect([[
|
|
|
|
|
|
2016-08-09 06:11:04 -07:00
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
2016-05-01 12:47:10 -07:00
|
|
|
:!Xtest-functional-viml-compl-dir^ |
|
|
|
|
]])
|
|
|
|
end)
|
2019-03-03 02:33:27 -07:00
|
|
|
|
2019-03-16 12:28:52 -07:00
|
|
|
it('completes env var names #9681', function()
|
2019-03-05 22:59:28 -07:00
|
|
|
clear()
|
|
|
|
screen:attach()
|
|
|
|
command('let $XTEST_1 = "foo" | let $XTEST_2 = "bar"')
|
2019-03-16 12:28:52 -07:00
|
|
|
command('set wildmenu wildmode=full')
|
2019-03-05 22:59:28 -07:00
|
|
|
feed(':!echo $XTEST_<tab>')
|
|
|
|
screen:expect([[
|
|
|
|
|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{2:XTEST_1}{3: XTEST_2 }|
|
|
|
|
:!echo $XTEST_1^ |
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
2019-03-03 02:33:27 -07:00
|
|
|
it('completes (multibyte) env var names #9655', function()
|
|
|
|
clear({env={
|
|
|
|
['XTEST_1AaあB']='foo',
|
|
|
|
['XTEST_2']='bar',
|
|
|
|
}})
|
|
|
|
screen:attach()
|
2019-03-16 12:28:52 -07:00
|
|
|
command('set wildmenu wildmode=full')
|
2019-03-03 02:33:27 -07:00
|
|
|
feed(':!echo $XTEST_<tab>')
|
|
|
|
screen:expect([[
|
|
|
|
|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{2:XTEST_1AaあB}{3: XTEST_2 }|
|
|
|
|
:!echo $XTEST_1AaあB^ |
|
|
|
|
]])
|
|
|
|
end)
|
2016-05-01 12:47:10 -07:00
|
|
|
end)
|
2017-02-23 23:12:34 -07:00
|
|
|
|
2017-10-31 02:45:06 -07:00
|
|
|
describe('ui/ext_wildmenu', function()
|
2017-02-23 23:12:34 -07:00
|
|
|
local screen
|
|
|
|
|
|
|
|
before_each(function()
|
|
|
|
clear()
|
|
|
|
screen = Screen.new(25, 5)
|
|
|
|
screen:attach({rgb=true, ext_wildmenu=true})
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('works with :sign <tab>', function()
|
|
|
|
local expected = {
|
|
|
|
'define',
|
|
|
|
'jump',
|
|
|
|
'list',
|
|
|
|
'place',
|
|
|
|
'undefine',
|
|
|
|
'unplace',
|
|
|
|
}
|
|
|
|
|
|
|
|
command('set wildmode=full')
|
|
|
|
command('set wildmenu')
|
|
|
|
feed(':sign <tab>')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-02-23 23:12:34 -07:00
|
|
|
|
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
:sign define^ |
|
2018-08-20 09:51:25 -07:00
|
|
|
]], wildmenu_items=expected, wildmenu_pos=0}
|
2017-02-23 23:12:34 -07:00
|
|
|
|
|
|
|
feed('<tab>')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-02-23 23:12:34 -07:00
|
|
|
|
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
:sign jump^ |
|
2018-08-20 09:51:25 -07:00
|
|
|
]], wildmenu_items=expected, wildmenu_pos=1}
|
2017-02-23 23:12:34 -07:00
|
|
|
|
|
|
|
feed('<left><left>')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-02-23 23:12:34 -07:00
|
|
|
|
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
:sign ^ |
|
2018-08-20 09:51:25 -07:00
|
|
|
]], wildmenu_items=expected, wildmenu_pos=-1}
|
2017-02-23 23:12:34 -07:00
|
|
|
|
|
|
|
feed('<right>')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-02-23 23:12:34 -07:00
|
|
|
|
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
:sign define^ |
|
2018-08-20 09:51:25 -07:00
|
|
|
]], wildmenu_items=expected, wildmenu_pos=0}
|
2017-02-23 23:12:34 -07:00
|
|
|
|
|
|
|
feed('a')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-02-23 23:12:34 -07:00
|
|
|
|
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
~ |
|
|
|
|
:sign definea^ |
|
2018-08-20 09:51:25 -07:00
|
|
|
]]}
|
2017-02-23 23:12:34 -07:00
|
|
|
end)
|
|
|
|
end)
|