2017-02-24 00:26:39 -07:00
|
|
|
local helpers = require('test.functional.helpers')(after_each)
|
|
|
|
local Screen = require('test.functional.ui.screen')
|
2018-08-20 09:51:25 -07:00
|
|
|
local clear, feed = helpers.clear, helpers.feed
|
2017-08-16 03:19:29 -07:00
|
|
|
local source = helpers.source
|
2017-08-20 08:47:42 -07:00
|
|
|
local command = helpers.command
|
2017-02-24 00:26:39 -07:00
|
|
|
|
2018-09-28 05:19:37 -07:00
|
|
|
local function test_cmdline(linegrid)
|
2017-02-24 00:26:39 -07:00
|
|
|
local screen
|
|
|
|
|
|
|
|
before_each(function()
|
|
|
|
clear()
|
|
|
|
screen = Screen.new(25, 5)
|
2018-09-28 05:19:37 -07:00
|
|
|
screen:attach({rgb=true, ext_cmdline=true, ext_linegrid=linegrid})
|
2017-12-05 05:16:56 -07:00
|
|
|
screen:set_default_attr_ids({
|
|
|
|
[1] = {bold = true, foreground = Screen.colors.Blue1},
|
|
|
|
[2] = {reverse = true},
|
|
|
|
[3] = {bold = true, reverse = true},
|
2018-05-31 07:12:00 -07:00
|
|
|
[4] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
|
|
|
|
[5] = {bold = true, foreground = Screen.colors.SeaGreen4},
|
2017-12-05 05:16:56 -07:00
|
|
|
})
|
2017-02-24 00:26:39 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
after_each(function()
|
|
|
|
screen:detach()
|
|
|
|
end)
|
|
|
|
|
2017-08-17 03:26:33 -07:00
|
|
|
it('works', function()
|
|
|
|
feed(':')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-08-17 03:26:33 -07:00
|
|
|
^ |
|
2017-12-05 05:16:56 -07:00
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]], cmdline={{
|
|
|
|
firstc = ":",
|
|
|
|
content = {{""}},
|
|
|
|
pos = 0,
|
|
|
|
}}}
|
2017-02-24 00:26:39 -07:00
|
|
|
|
2017-08-17 03:26:33 -07:00
|
|
|
feed('sign')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-08-17 03:26:33 -07:00
|
|
|
^ |
|
2017-12-05 05:16:56 -07:00
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]], cmdline={{
|
|
|
|
firstc = ":",
|
|
|
|
content = {{"sign"}},
|
|
|
|
pos = 4,
|
|
|
|
}}}
|
2017-02-24 00:26:39 -07:00
|
|
|
|
2017-08-17 03:26:33 -07:00
|
|
|
feed('<Left>')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-08-17 03:26:33 -07:00
|
|
|
^ |
|
2017-12-05 05:16:56 -07:00
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]], cmdline={{
|
|
|
|
firstc = ":",
|
|
|
|
content = {{"sign"}},
|
|
|
|
pos = 3,
|
|
|
|
}}}
|
2017-02-24 00:26:39 -07:00
|
|
|
|
2017-08-17 03:26:33 -07:00
|
|
|
feed('<bs>')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-08-17 03:26:33 -07:00
|
|
|
^ |
|
2017-12-05 05:16:56 -07:00
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]], cmdline={{
|
|
|
|
firstc = ":",
|
|
|
|
content = {{"sin"}},
|
|
|
|
pos = 2,
|
|
|
|
}}}
|
2017-02-24 00:26:39 -07:00
|
|
|
|
2017-08-17 03:26:33 -07:00
|
|
|
feed('<Esc>')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-08-17 03:26:33 -07:00
|
|
|
^ |
|
2017-12-05 05:16:56 -07:00
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]]}
|
2017-08-17 03:26:33 -07:00
|
|
|
end)
|
2017-02-24 00:26:39 -07:00
|
|
|
|
2018-05-31 07:12:00 -07:00
|
|
|
describe("redraws statusline on entering", function()
|
|
|
|
before_each(function()
|
|
|
|
command('set laststatus=2')
|
|
|
|
command('set statusline=%{mode()}')
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('from normal mode', function()
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
|
|
|
^ |
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{3:n }|
|
|
|
|
|
|
|
|
|
]]}
|
|
|
|
|
2018-05-31 07:12:00 -07:00
|
|
|
feed(':')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2018-07-06 05:39:50 -07:00
|
|
|
^ |
|
2018-05-31 07:12:00 -07:00
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
2018-07-06 05:39:50 -07:00
|
|
|
{3:c }|
|
2018-05-31 07:12:00 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]], cmdline={{
|
|
|
|
firstc = ":",
|
|
|
|
content = {{""}},
|
|
|
|
pos = 0,
|
|
|
|
}}}
|
2018-05-31 07:12:00 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('but not with scrolled messages', function()
|
2018-11-29 20:44:52 -07:00
|
|
|
screen:try_resize(49,10)
|
2018-05-31 07:12:00 -07:00
|
|
|
feed(':echoerr doesnotexist<cr>')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2018-11-29 20:44:52 -07:00
|
|
|
^ |
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{3:n }|
|
|
|
|
{4:E121: Undefined variable: doesnotexist} |
|
2018-08-20 09:51:25 -07:00
|
|
|
]]}
|
2018-05-31 07:12:00 -07:00
|
|
|
feed(':echoerr doesnotexist<cr>')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2018-11-29 20:44:52 -07:00
|
|
|
^ |
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{3:n }|
|
|
|
|
{4:E121: Undefined variable: doesnotexist} |
|
2018-08-20 09:51:25 -07:00
|
|
|
]]}
|
2018-05-31 07:12:00 -07:00
|
|
|
|
|
|
|
feed(':echoerr doesnotexist<cr>')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2018-11-29 20:44:52 -07:00
|
|
|
^ |
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{3:n }|
|
|
|
|
{4:E121: Undefined variable: doesnotexist} |
|
2018-08-20 09:51:25 -07:00
|
|
|
]]}
|
2018-05-31 07:12:00 -07:00
|
|
|
|
|
|
|
feed('<cr>')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2018-11-29 20:44:52 -07:00
|
|
|
^ |
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{3:n }|
|
|
|
|
{4:E121: Undefined variable: doesnotexist} |
|
2018-08-20 09:51:25 -07:00
|
|
|
]]}
|
2018-05-10 05:55:07 -07:00
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
2017-08-17 03:26:33 -07:00
|
|
|
it("works with input()", function()
|
|
|
|
feed(':call input("input", "default")<cr>')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-08-17 03:26:33 -07:00
|
|
|
^ |
|
2017-12-05 05:16:56 -07:00
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]], cmdline={{
|
|
|
|
prompt = "input",
|
|
|
|
content = {{"default"}},
|
|
|
|
pos = 7,
|
|
|
|
}}}
|
|
|
|
|
2017-08-17 03:26:33 -07:00
|
|
|
feed('<cr>')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-08-17 03:26:33 -07:00
|
|
|
^ |
|
2017-12-05 05:16:56 -07:00
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]]}
|
2017-08-17 03:26:33 -07:00
|
|
|
end)
|
2017-05-10 23:51:10 -07:00
|
|
|
|
2017-08-17 03:26:33 -07:00
|
|
|
it("works with special chars and nested cmdline", function()
|
|
|
|
feed(':xx<c-r>')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-08-17 03:26:33 -07:00
|
|
|
^ |
|
2017-12-05 05:16:56 -07:00
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]], cmdline={{
|
|
|
|
firstc = ":",
|
|
|
|
content = {{"xx"}},
|
|
|
|
pos = 2,
|
|
|
|
special = {'"', true},
|
|
|
|
}}}
|
2017-05-10 23:51:10 -07:00
|
|
|
|
2017-08-17 03:26:33 -07:00
|
|
|
feed('=')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-08-17 03:26:33 -07:00
|
|
|
^ |
|
2017-12-05 05:16:56 -07:00
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]], cmdline={{
|
|
|
|
firstc = ":",
|
|
|
|
content = {{"xx"}},
|
|
|
|
pos = 2,
|
|
|
|
special = {'"', true},
|
|
|
|
}, {
|
|
|
|
firstc = "=",
|
|
|
|
content = {{""}},
|
|
|
|
pos = 0,
|
|
|
|
}}}
|
2017-05-10 23:51:10 -07:00
|
|
|
|
2017-08-17 03:26:33 -07:00
|
|
|
feed('1+2')
|
2017-08-20 08:47:42 -07:00
|
|
|
local expectation = {{
|
2018-08-20 09:51:25 -07:00
|
|
|
firstc = ":",
|
|
|
|
content = {{"xx"}},
|
|
|
|
pos = 2,
|
|
|
|
special = {'"', true},
|
|
|
|
}, {
|
|
|
|
firstc = "=",
|
|
|
|
content = {{"1"}, {"+"}, {"2"}},
|
|
|
|
pos = 3,
|
|
|
|
}}
|
|
|
|
|
|
|
|
screen:expect{grid=[[
|
2017-08-20 08:47:42 -07:00
|
|
|
^ |
|
2017-12-05 05:16:56 -07:00
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
2017-08-20 08:47:42 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]], cmdline=expectation}
|
2017-02-24 00:26:39 -07:00
|
|
|
|
2017-08-20 08:47:42 -07:00
|
|
|
-- erase information, so we check if it is retransmitted
|
2018-10-20 14:43:47 -07:00
|
|
|
command("mode")
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2018-07-06 05:39:50 -07:00
|
|
|
^ |
|
2017-12-05 05:16:56 -07:00
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
2018-07-06 05:39:50 -07:00
|
|
|
|
|
2017-06-26 05:49:15 -07:00
|
|
|
]], cmdline=expectation, reset=true}
|
2017-08-20 08:47:42 -07:00
|
|
|
|
|
|
|
|
|
|
|
feed('<cr>')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2018-07-06 05:39:50 -07:00
|
|
|
^ |
|
2017-12-05 05:16:56 -07:00
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
2018-07-06 05:39:50 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]], cmdline={{
|
|
|
|
firstc = ":",
|
|
|
|
content = {{"xx3"}},
|
|
|
|
pos = 3,
|
|
|
|
}}}
|
2017-06-26 03:19:40 -07:00
|
|
|
|
2017-08-17 03:26:33 -07:00
|
|
|
feed('<esc>')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-08-17 03:26:33 -07:00
|
|
|
^ |
|
2017-12-05 05:16:56 -07:00
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]]}
|
2017-08-17 03:26:33 -07:00
|
|
|
end)
|
2017-06-26 03:19:40 -07:00
|
|
|
|
2017-08-17 03:26:33 -07:00
|
|
|
it("works with function definitions", function()
|
|
|
|
feed(':function Foo()<cr>')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-08-17 03:26:33 -07:00
|
|
|
^ |
|
2017-12-05 05:16:56 -07:00
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]], cmdline={{
|
|
|
|
indent = 2,
|
|
|
|
firstc = ":",
|
|
|
|
content = {{""}},
|
|
|
|
pos = 0,
|
|
|
|
}}, cmdline_block = {
|
|
|
|
{{'function Foo()'}},
|
|
|
|
}}
|
2017-06-26 03:19:40 -07:00
|
|
|
|
2017-08-17 03:26:33 -07:00
|
|
|
feed('line1<cr>')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-08-17 03:26:33 -07:00
|
|
|
^ |
|
2017-12-05 05:16:56 -07:00
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]], cmdline={{
|
|
|
|
indent = 2,
|
|
|
|
firstc = ":",
|
|
|
|
content = {{""}},
|
|
|
|
pos = 0,
|
|
|
|
}}, cmdline_block = {
|
|
|
|
{{'function Foo()'}},
|
|
|
|
{{' line1'}},
|
|
|
|
}}
|
2017-06-26 07:27:49 -07:00
|
|
|
|
2018-10-20 14:43:47 -07:00
|
|
|
command("mode")
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2018-07-06 05:39:50 -07:00
|
|
|
^ |
|
2017-12-05 05:16:56 -07:00
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
2018-07-06 05:39:50 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]], cmdline={{
|
|
|
|
indent = 2,
|
|
|
|
firstc = ":",
|
|
|
|
content = {{""}},
|
|
|
|
pos = 0,
|
|
|
|
}}, cmdline_block = {
|
|
|
|
{{'function Foo()'}},
|
|
|
|
{{' line1'}},
|
2017-06-26 05:49:15 -07:00
|
|
|
}, reset=true}
|
2017-08-20 08:47:42 -07:00
|
|
|
|
2018-02-13 11:47:27 -07:00
|
|
|
feed('endfunction<cr>')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2018-02-13 11:47:27 -07:00
|
|
|
^ |
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]]}
|
2018-02-13 11:47:27 -07:00
|
|
|
|
|
|
|
-- Try once more, to check buffer is reinitialized. #8007
|
|
|
|
feed(':function Bar()<cr>')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2018-02-13 11:47:27 -07:00
|
|
|
^ |
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]], cmdline={{
|
|
|
|
indent = 2,
|
|
|
|
firstc = ":",
|
|
|
|
content = {{""}},
|
|
|
|
pos = 0,
|
|
|
|
}}, cmdline_block = {
|
|
|
|
{{'function Bar()'}},
|
|
|
|
}}
|
2017-08-20 08:47:42 -07:00
|
|
|
|
2017-08-17 03:26:33 -07:00
|
|
|
feed('endfunction<cr>')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-08-17 03:26:33 -07:00
|
|
|
^ |
|
2017-12-05 05:16:56 -07:00
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]]}
|
|
|
|
|
2017-02-24 00:26:39 -07:00
|
|
|
end)
|
2017-08-16 03:19:29 -07:00
|
|
|
|
2017-08-27 00:57:30 -07:00
|
|
|
it("works with cmdline window", function()
|
|
|
|
feed(':make')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-08-27 00:57:30 -07:00
|
|
|
^ |
|
2017-12-05 05:16:56 -07:00
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
2017-08-27 00:57:30 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]], cmdline={{
|
|
|
|
firstc = ":",
|
|
|
|
content = {{"make"}},
|
|
|
|
pos = 4,
|
|
|
|
}}}
|
2017-08-27 00:57:30 -07:00
|
|
|
|
|
|
|
feed('<c-f>')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-08-27 00:57:30 -07:00
|
|
|
|
|
2017-12-05 05:16:56 -07:00
|
|
|
{2:[No Name] }|
|
|
|
|
{1::}make^ |
|
|
|
|
{3:[Command Line] }|
|
2017-08-27 00:57:30 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]]}
|
2017-08-27 00:57:30 -07:00
|
|
|
|
|
|
|
-- nested cmdline
|
|
|
|
feed(':yank')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-08-27 00:57:30 -07:00
|
|
|
|
|
2017-12-05 05:16:56 -07:00
|
|
|
{2:[No Name] }|
|
|
|
|
{1::}make^ |
|
|
|
|
{3:[Command Line] }|
|
2017-08-27 00:57:30 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]], cmdline={nil, {
|
|
|
|
firstc = ":",
|
|
|
|
content = {{"yank"}},
|
|
|
|
pos = 4,
|
|
|
|
}}}
|
2017-08-27 00:57:30 -07:00
|
|
|
|
2018-10-20 14:43:47 -07:00
|
|
|
command("mode")
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-08-27 00:57:30 -07:00
|
|
|
|
|
2017-12-05 05:16:56 -07:00
|
|
|
{2:[No Name] }|
|
2018-07-06 05:39:50 -07:00
|
|
|
{1::}make^ |
|
2017-12-05 05:16:56 -07:00
|
|
|
{3:[Command Line] }|
|
2018-07-06 05:39:50 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]], cmdline={nil, {
|
|
|
|
firstc = ":",
|
|
|
|
content = {{"yank"}},
|
|
|
|
pos = 4,
|
2017-06-26 05:49:15 -07:00
|
|
|
}}, reset=true}
|
2017-08-27 00:57:30 -07:00
|
|
|
|
|
|
|
feed("<c-c>")
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2017-12-05 05:16:56 -07:00
|
|
|
{2:[No Name] }|
|
|
|
|
{1::}make^ |
|
|
|
|
{3:[Command Line] }|
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]]}
|
2017-08-17 03:26:33 -07:00
|
|
|
|
2017-08-27 00:57:30 -07:00
|
|
|
feed("<c-c>")
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2018-10-20 14:43:47 -07:00
|
|
|
^ |
|
2017-12-05 05:16:56 -07:00
|
|
|
{2:[No Name] }|
|
2018-10-20 14:43:47 -07:00
|
|
|
{1::}make |
|
2017-12-05 05:16:56 -07:00
|
|
|
{3:[Command Line] }|
|
2017-08-27 00:57:30 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]], cmdline={{
|
|
|
|
firstc = ":",
|
|
|
|
content = {{"make"}},
|
|
|
|
pos = 4,
|
|
|
|
}}}
|
2017-08-27 00:57:30 -07:00
|
|
|
|
|
|
|
command("redraw!")
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2018-07-06 05:39:50 -07:00
|
|
|
^ |
|
2017-12-05 05:16:56 -07:00
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
2018-07-06 05:39:50 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]], cmdline={{
|
|
|
|
firstc = ":",
|
|
|
|
content = {{"make"}},
|
|
|
|
pos = 4,
|
|
|
|
}}}
|
2017-08-17 03:26:33 -07:00
|
|
|
end)
|
|
|
|
|
2017-08-29 23:51:39 -07:00
|
|
|
it('works with inputsecret()', function()
|
|
|
|
feed(":call inputsecret('secret:')<cr>abc123")
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-08-29 23:51:39 -07:00
|
|
|
^ |
|
2017-12-05 05:16:56 -07:00
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
2017-08-29 23:51:39 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]], cmdline={{
|
|
|
|
prompt = "secret:",
|
|
|
|
content = {{"******"}},
|
|
|
|
pos = 6,
|
|
|
|
}}}
|
2017-08-29 23:51:39 -07:00
|
|
|
end)
|
|
|
|
|
2017-08-16 03:19:29 -07:00
|
|
|
it('works with highlighted cmdline', function()
|
2017-12-05 05:16:56 -07:00
|
|
|
source([[
|
|
|
|
highlight RBP1 guibg=Red
|
|
|
|
highlight RBP2 guibg=Yellow
|
|
|
|
highlight RBP3 guibg=Green
|
|
|
|
highlight RBP4 guibg=Blue
|
|
|
|
let g:NUM_LVLS = 4
|
|
|
|
function RainBowParens(cmdline)
|
|
|
|
let ret = []
|
|
|
|
let i = 0
|
|
|
|
let lvl = 0
|
|
|
|
while i < len(a:cmdline)
|
|
|
|
if a:cmdline[i] is# '('
|
|
|
|
call add(ret, [i, i + 1, 'RBP' . ((lvl % g:NUM_LVLS) + 1)])
|
|
|
|
let lvl += 1
|
|
|
|
elseif a:cmdline[i] is# ')'
|
|
|
|
let lvl -= 1
|
|
|
|
call add(ret, [i, i + 1, 'RBP' . ((lvl % g:NUM_LVLS) + 1)])
|
|
|
|
endif
|
|
|
|
let i += 1
|
|
|
|
endwhile
|
|
|
|
return ret
|
|
|
|
endfunction
|
|
|
|
map <f5> :let x = input({'prompt':'>','highlight':'RainBowParens'})<cr>
|
|
|
|
"map <f5> :let x = input({'prompt':'>'})<cr>
|
|
|
|
]])
|
|
|
|
screen:set_default_attr_ids({
|
|
|
|
RBP1={background = Screen.colors.Red},
|
|
|
|
RBP2={background = Screen.colors.Yellow},
|
|
|
|
EOB={bold = true, foreground = Screen.colors.Blue1},
|
|
|
|
})
|
|
|
|
feed('<f5>(a(b)a)')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-12-05 05:16:56 -07:00
|
|
|
^ |
|
|
|
|
{EOB:~ }|
|
|
|
|
{EOB:~ }|
|
|
|
|
{EOB:~ }|
|
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]], cmdline={{
|
|
|
|
prompt = '>',
|
|
|
|
content = {{'(', 'RBP1'}, {'a'}, {'(', 'RBP2'}, {'b'},
|
|
|
|
{ ')', 'RBP2'}, {'a'}, {')', 'RBP1'}},
|
|
|
|
pos = 7,
|
|
|
|
}}}
|
2017-08-16 03:19:29 -07:00
|
|
|
end)
|
2017-12-05 05:27:06 -07:00
|
|
|
|
|
|
|
it('works together with ext_wildmenu', function()
|
|
|
|
local expected = {
|
|
|
|
'define',
|
|
|
|
'jump',
|
|
|
|
'list',
|
|
|
|
'place',
|
|
|
|
'undefine',
|
|
|
|
'unplace',
|
|
|
|
}
|
|
|
|
|
|
|
|
command('set wildmode=full')
|
|
|
|
command('set wildmenu')
|
|
|
|
screen:set_option('ext_wildmenu', true)
|
|
|
|
feed(':sign <tab>')
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-12-05 05:27:06 -07:00
|
|
|
^ |
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]], cmdline={{
|
|
|
|
firstc = ":",
|
|
|
|
content = {{"sign define"}},
|
|
|
|
pos = 11,
|
|
|
|
}}, wildmenu_items=expected, wildmenu_pos=0}
|
2017-12-05 05:27:06 -07:00
|
|
|
|
|
|
|
feed('<tab>')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-12-05 05:27:06 -07:00
|
|
|
^ |
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]], cmdline={{
|
|
|
|
firstc = ":",
|
|
|
|
content = {{"sign jump"}},
|
|
|
|
pos = 9,
|
|
|
|
}}, wildmenu_items=expected, wildmenu_pos=1}
|
2017-12-05 05:27:06 -07:00
|
|
|
|
|
|
|
feed('<left><left>')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-12-05 05:27:06 -07:00
|
|
|
^ |
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]], cmdline={{
|
|
|
|
firstc = ":",
|
|
|
|
content = {{"sign "}},
|
|
|
|
pos = 5,
|
|
|
|
}}, wildmenu_items=expected, wildmenu_pos=-1}
|
2017-12-05 05:27:06 -07:00
|
|
|
|
|
|
|
feed('<right>')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-12-05 05:27:06 -07:00
|
|
|
^ |
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]], cmdline={{
|
|
|
|
firstc = ":",
|
|
|
|
content = {{"sign define"}},
|
|
|
|
pos = 11,
|
|
|
|
}}, wildmenu_items=expected, wildmenu_pos=0}
|
2017-12-05 05:27:06 -07:00
|
|
|
|
|
|
|
feed('a')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect{grid=[[
|
2017-12-05 05:27:06 -07:00
|
|
|
^ |
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
{1:~ }|
|
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]], cmdline={{
|
|
|
|
firstc = ":",
|
|
|
|
content = {{"sign definea"}},
|
|
|
|
pos = 12,
|
|
|
|
}}}
|
2017-12-05 05:27:06 -07:00
|
|
|
end)
|
2018-08-20 09:51:25 -07:00
|
|
|
end
|
|
|
|
|
2018-09-28 05:19:37 -07:00
|
|
|
-- the representation of cmdline and cmdline_block contents changed with ext_linegrid
|
2018-08-20 09:51:25 -07:00
|
|
|
-- (which uses indexed highlights) so make sure to test both
|
|
|
|
describe('ui/ext_cmdline', function() test_cmdline(true) end)
|
|
|
|
describe('ui/ext_cmdline (legacy highlights)', function() test_cmdline(false) end)
|