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
|
2021-04-01 04:46:12 -07:00
|
|
|
local assert_alive = helpers.assert_alive
|
2023-01-12 21:25:19 -07:00
|
|
|
local poke_eventloop = helpers.poke_eventloop
|
2022-09-26 06:23:43 -07:00
|
|
|
local exec = helpers.exec
|
2022-06-13 02:40:51 -07:00
|
|
|
local eval = helpers.eval
|
|
|
|
local eq = helpers.eq
|
2022-11-21 17:13:30 -07:00
|
|
|
local is_os = helpers.is_os
|
2024-01-12 10:59:57 -07:00
|
|
|
local api = helpers.api
|
2017-02-24 00:26:39 -07:00
|
|
|
|
2019-05-26 10:52:30 -07:00
|
|
|
local function new_screen(opt)
|
|
|
|
local screen = Screen.new(25, 5)
|
|
|
|
screen:attach(opt)
|
|
|
|
screen:set_default_attr_ids({
|
2024-01-02 18:09:18 -07:00
|
|
|
[1] = { bold = true, foreground = Screen.colors.Blue1 },
|
|
|
|
[2] = { reverse = true },
|
|
|
|
[3] = { bold = true, reverse = true },
|
|
|
|
[4] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
|
|
|
|
[5] = { bold = true, foreground = Screen.colors.SeaGreen4 },
|
|
|
|
[6] = { foreground = Screen.colors.Magenta },
|
|
|
|
[7] = { bold = true, foreground = Screen.colors.Brown },
|
|
|
|
[8] = { background = Screen.colors.LightGrey },
|
|
|
|
[9] = { bold = true },
|
|
|
|
[10] = { background = Screen.colors.Yellow1 },
|
2019-05-26 10:52:30 -07:00
|
|
|
})
|
|
|
|
return screen
|
|
|
|
end
|
|
|
|
|
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()
|
2024-01-02 18:09:18 -07:00
|
|
|
screen = new_screen({ rgb = true, ext_cmdline = true, ext_linegrid = linegrid })
|
2017-02-24 00:26:39 -07:00
|
|
|
end)
|
|
|
|
|
2017-08-17 03:26:33 -07:00
|
|
|
it('works', function()
|
|
|
|
feed(':')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-08-17 03:26:33 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -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')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-08-17 03:26:33 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -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>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-08-17 03:26:33 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -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>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-08-17 03:26:33 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -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>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-08-17 03:26:33 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2017-08-17 03:26:33 -07:00
|
|
|
end)
|
2017-02-24 00:26:39 -07:00
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
it('works with input()', function()
|
2017-08-17 03:26:33 -07:00
|
|
|
feed(':call input("input", "default")<cr>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-08-17 03:26:33 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
|
|
|
{
|
|
|
|
prompt = 'input',
|
|
|
|
content = { { 'default' } },
|
|
|
|
pos = 7,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2018-08-20 09:51:25 -07:00
|
|
|
|
2017-08-17 03:26:33 -07:00
|
|
|
feed('<cr>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-08-17 03:26:33 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2017-08-17 03:26:33 -07:00
|
|
|
end)
|
2017-05-10 23:51:10 -07:00
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
it('works with special chars and nested cmdline', function()
|
2017-08-17 03:26:33 -07:00
|
|
|
feed(':xx<c-r>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-08-17 03:26:33 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -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('=')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-08-17 03:26:33 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -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')
|
2024-01-02 18:09:18 -07:00
|
|
|
local expectation = {
|
|
|
|
{
|
|
|
|
firstc = ':',
|
|
|
|
content = { { 'xx' } },
|
|
|
|
pos = 2,
|
|
|
|
special = { '"', true },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
firstc = '=',
|
|
|
|
content = { { '1', 6 }, { '+', 7 }, { '2', 6 } },
|
|
|
|
pos = 3,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-08-20 08:47:42 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-08-20 08:47:42 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -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
|
2024-01-02 18:09:18 -07:00
|
|
|
command('mode')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2018-07-06 05:39:50 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2018-07-06 05:39:50 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
cmdline = expectation,
|
|
|
|
reset = true,
|
|
|
|
}
|
2017-08-20 08:47:42 -07:00
|
|
|
|
|
|
|
feed('<cr>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2018-07-06 05:39:50 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2018-07-06 05:39:50 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -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>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-08-17 03:26:33 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2017-08-17 03:26:33 -07:00
|
|
|
end)
|
2017-06-26 03:19:40 -07:00
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
it('works with function definitions', function()
|
2017-08-17 03:26:33 -07:00
|
|
|
feed(':function Foo()<cr>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-08-17 03:26:33 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -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>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-08-17 03:26:33 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
|
|
|
{
|
|
|
|
indent = 2,
|
|
|
|
firstc = ':',
|
|
|
|
content = { { '' } },
|
|
|
|
pos = 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
cmdline_block = {
|
|
|
|
{ { 'function Foo()' } },
|
|
|
|
{ { ' line1' } },
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
command('mode')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2018-07-06 05:39:50 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2018-07-06 05:39:50 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
|
|
|
{
|
|
|
|
indent = 2,
|
|
|
|
firstc = ':',
|
|
|
|
content = { { '' } },
|
|
|
|
pos = 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
cmdline_block = {
|
|
|
|
{ { 'function Foo()' } },
|
|
|
|
{ { ' line1' } },
|
|
|
|
},
|
|
|
|
reset = true,
|
|
|
|
}
|
2017-08-20 08:47:42 -07:00
|
|
|
|
2018-02-13 11:47:27 -07:00
|
|
|
feed('endfunction<cr>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2018-02-13 11:47:27 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2018-02-13 11:47:27 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2018-02-13 11:47:27 -07:00
|
|
|
|
|
|
|
-- Try once more, to check buffer is reinitialized. #8007
|
|
|
|
feed(':function Bar()<cr>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2018-02-13 11:47:27 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2018-02-13 11:47:27 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -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>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-08-17 03:26:33 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2017-02-24 00:26:39 -07:00
|
|
|
end)
|
2017-08-16 03:19:29 -07:00
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
it('works with cmdline window', function()
|
2017-08-27 00:57:30 -07:00
|
|
|
feed(':make')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-08-27 00:57:30 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-08-27 00:57:30 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
|
|
|
{
|
|
|
|
firstc = ':',
|
|
|
|
content = { { 'make' } },
|
|
|
|
pos = 4,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2017-08-27 00:57:30 -07:00
|
|
|
|
|
|
|
feed('<c-f>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-08-27 00:57:30 -07:00
|
|
|
|
|
2017-12-05 05:16:56 -07:00
|
|
|
{2:[No Name] }|
|
2023-08-22 07:48:55 -07:00
|
|
|
{1::}mak^e |
|
2017-12-05 05:16:56 -07:00
|
|
|
{3:[Command Line] }|
|
2017-08-27 00:57:30 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2017-08-27 00:57:30 -07:00
|
|
|
|
|
|
|
-- nested cmdline
|
|
|
|
feed(':yank')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-08-27 00:57:30 -07:00
|
|
|
|
|
2017-12-05 05:16:56 -07:00
|
|
|
{2:[No Name] }|
|
2023-08-22 07:48:55 -07:00
|
|
|
{1::}mak^e |
|
2017-12-05 05:16:56 -07:00
|
|
|
{3:[Command Line] }|
|
2017-08-27 00:57:30 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
|
|
|
nil,
|
|
|
|
{
|
|
|
|
firstc = ':',
|
|
|
|
content = { { 'yank' } },
|
|
|
|
pos = 4,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
command('mode')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-08-27 00:57:30 -07:00
|
|
|
|
|
2017-12-05 05:16:56 -07:00
|
|
|
{2:[No Name] }|
|
2023-08-22 07:48:55 -07:00
|
|
|
{1::}mak^e |
|
2017-12-05 05:16:56 -07:00
|
|
|
{3:[Command Line] }|
|
2018-07-06 05:39:50 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
|
|
|
nil,
|
|
|
|
{
|
|
|
|
firstc = ':',
|
|
|
|
content = { { 'yank' } },
|
|
|
|
pos = 4,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
reset = true,
|
|
|
|
}
|
|
|
|
|
|
|
|
feed('<c-c>')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2017-12-05 05:16:56 -07:00
|
|
|
{2:[No Name] }|
|
2023-08-22 07:48:55 -07:00
|
|
|
{1::}mak^e |
|
2017-12-05 05:16:56 -07:00
|
|
|
{3:[Command Line] }|
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2017-08-17 03:26:33 -07:00
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
feed('<c-c>')
|
|
|
|
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
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
|
|
|
{
|
|
|
|
firstc = ':',
|
|
|
|
content = { { 'make' } },
|
|
|
|
pos = 4,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
command('redraw!')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2018-07-06 05:39:50 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2018-07-06 05:39:50 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -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")
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-08-29 23:51:39 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-08-29 23:51:39 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -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({
|
2024-01-02 18:09:18 -07:00
|
|
|
RBP1 = { background = Screen.colors.Red },
|
|
|
|
RBP2 = { background = Screen.colors.Yellow },
|
|
|
|
EOB = { bold = true, foreground = Screen.colors.Blue1 },
|
2017-12-05 05:16:56 -07:00
|
|
|
})
|
|
|
|
feed('<f5>(a(b)a)')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-12-05 05:16:56 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{EOB:~ }|*3
|
2017-12-05 05:16:56 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -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>')
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-12-05 05:27:06 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-12-05 05:27:06 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -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>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-12-05 05:27:06 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-12-05 05:27:06 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -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>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-12-05 05:27:06 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-12-05 05:27:06 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
|
|
|
{
|
|
|
|
firstc = ':',
|
|
|
|
content = { { 'sign ' } },
|
|
|
|
pos = 5,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
wildmenu_items = expected,
|
|
|
|
wildmenu_pos = -1,
|
|
|
|
}
|
2017-12-05 05:27:06 -07:00
|
|
|
|
|
|
|
feed('<right>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-12-05 05:27:06 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-12-05 05:27:06 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -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')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-12-05 05:27:06 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-12-05 05:27:06 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
|
|
|
{
|
|
|
|
firstc = ':',
|
|
|
|
content = { { 'sign definea' } },
|
|
|
|
pos = 12,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2017-12-05 05:27:06 -07:00
|
|
|
end)
|
2019-03-04 02:59:44 -07:00
|
|
|
|
|
|
|
it('works together with ext_popupmenu', function()
|
|
|
|
local expected = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{ 'define', '', '', '' },
|
|
|
|
{ 'jump', '', '', '' },
|
|
|
|
{ 'list', '', '', '' },
|
|
|
|
{ 'place', '', '', '' },
|
|
|
|
{ 'undefine', '', '', '' },
|
|
|
|
{ 'unplace', '', '', '' },
|
2019-03-04 02:59:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
command('set wildmode=full')
|
|
|
|
command('set wildmenu')
|
|
|
|
screen:set_option('ext_popupmenu', true)
|
|
|
|
feed(':sign <tab>')
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2019-03-04 02:59:44 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2019-03-04 02:59:44 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
|
|
|
{
|
|
|
|
firstc = ':',
|
|
|
|
content = { { 'sign define' } },
|
|
|
|
pos = 11,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
popupmenu = { items = expected, pos = 0, anchor = { -1, 0, 5 } },
|
|
|
|
}
|
2019-03-04 02:59:44 -07:00
|
|
|
|
|
|
|
feed('<tab>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2019-03-04 02:59:44 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2019-03-04 02:59:44 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
|
|
|
{
|
|
|
|
firstc = ':',
|
|
|
|
content = { { 'sign jump' } },
|
|
|
|
pos = 9,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
popupmenu = { items = expected, pos = 1, anchor = { -1, 0, 5 } },
|
|
|
|
}
|
2019-03-04 02:59:44 -07:00
|
|
|
|
|
|
|
feed('<left><left>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2019-03-04 02:59:44 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2019-03-04 02:59:44 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
|
|
|
{
|
|
|
|
firstc = ':',
|
|
|
|
content = { { 'sign ' } },
|
|
|
|
pos = 5,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
popupmenu = { items = expected, pos = -1, anchor = { -1, 0, 5 } },
|
|
|
|
}
|
2019-03-04 02:59:44 -07:00
|
|
|
|
|
|
|
feed('<right>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2019-03-04 02:59:44 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2019-03-04 02:59:44 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
|
|
|
{
|
|
|
|
firstc = ':',
|
|
|
|
content = { { 'sign define' } },
|
|
|
|
pos = 11,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
popupmenu = { items = expected, pos = 0, anchor = { -1, 0, 5 } },
|
|
|
|
}
|
2019-03-04 02:59:44 -07:00
|
|
|
|
|
|
|
feed('a')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2019-03-04 02:59:44 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2019-03-04 02:59:44 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
|
|
|
{
|
|
|
|
firstc = ':',
|
|
|
|
content = { { 'sign definea' } },
|
|
|
|
pos = 12,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2019-03-04 02:59:44 -07:00
|
|
|
feed('<esc>')
|
|
|
|
|
|
|
|
-- check positioning with multibyte char in pattern
|
2024-01-02 18:09:18 -07:00
|
|
|
command('e långfile1')
|
|
|
|
command('sp långfile2')
|
2019-03-04 02:59:44 -07:00
|
|
|
feed(':b lå<tab>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2019-03-04 02:59:44 -07:00
|
|
|
^ |
|
|
|
|
{3:långfile2 }|
|
|
|
|
|
|
|
|
|
{2:långfile1 }|
|
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
popupmenu = {
|
|
|
|
anchor = { -1, 0, 2 },
|
|
|
|
items = { { 'långfile1', '', '', '' }, { 'långfile2', '', '', '' } },
|
|
|
|
pos = 0,
|
|
|
|
},
|
|
|
|
cmdline = {
|
|
|
|
{
|
|
|
|
content = { { 'b långfile1' } },
|
|
|
|
firstc = ':',
|
|
|
|
pos = 12,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2019-03-04 02:59:44 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('ext_wildmenu takes precedence over ext_popupmenu', function()
|
|
|
|
local expected = {
|
|
|
|
'define',
|
|
|
|
'jump',
|
|
|
|
'list',
|
|
|
|
'place',
|
|
|
|
'undefine',
|
|
|
|
'unplace',
|
|
|
|
}
|
|
|
|
|
|
|
|
command('set wildmode=full')
|
|
|
|
command('set wildmenu')
|
|
|
|
screen:set_option('ext_wildmenu', true)
|
|
|
|
screen:set_option('ext_popupmenu', true)
|
|
|
|
feed(':sign <tab>')
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2019-03-04 02:59:44 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2019-03-04 02:59:44 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
|
|
|
{
|
|
|
|
firstc = ':',
|
|
|
|
content = { { 'sign define' } },
|
|
|
|
pos = 11,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
wildmenu_items = expected,
|
|
|
|
wildmenu_pos = 0,
|
|
|
|
}
|
2019-03-04 02:59:44 -07:00
|
|
|
end)
|
|
|
|
|
2019-06-25 22:22:19 -07:00
|
|
|
it("doesn't send invalid events when aborting mapping #10000", function()
|
2021-04-10 09:36:54 -07:00
|
|
|
command('set notimeout')
|
2019-06-25 22:22:19 -07:00
|
|
|
command('cnoremap ab c')
|
|
|
|
|
|
|
|
feed(':xa')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2019-06-25 22:22:19 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2019-06-25 22:22:19 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
|
|
|
{
|
|
|
|
content = { { 'x' } },
|
|
|
|
firstc = ':',
|
|
|
|
pos = 1,
|
|
|
|
special = { 'a', false },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2019-06-25 22:22:19 -07:00
|
|
|
|
|
|
|
-- This used to send an invalid event where pos where larger than the total
|
2019-11-26 05:15:14 -07:00
|
|
|
-- length of content. Checked in _handle_cmdline_show.
|
2019-06-25 22:22:19 -07:00
|
|
|
feed('<esc>')
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2019-06-25 22:22:19 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
2018-08-20 09:51:25 -07:00
|
|
|
end
|
|
|
|
|
2019-06-25 22:22:19 -07:00
|
|
|
-- the representation of cmdline and cmdline_block contents changed with ext_linegrid
|
|
|
|
-- (which uses indexed highlights) so make sure to test both
|
2024-01-02 18:09:18 -07:00
|
|
|
describe('ui/ext_cmdline', function()
|
|
|
|
test_cmdline(true)
|
|
|
|
end)
|
|
|
|
describe('ui/ext_cmdline (legacy highlights)', function()
|
|
|
|
test_cmdline(false)
|
|
|
|
end)
|
2019-06-25 22:22:19 -07:00
|
|
|
|
2019-05-26 10:52:30 -07:00
|
|
|
describe('cmdline redraw', function()
|
|
|
|
local screen
|
|
|
|
before_each(function()
|
|
|
|
clear()
|
2024-01-02 18:09:18 -07:00
|
|
|
screen = new_screen({ rgb = true })
|
2019-05-26 10:52:30 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('with timer', function()
|
|
|
|
feed(':012345678901234567890123456789')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2019-05-26 10:52:30 -07:00
|
|
|
|
|
|
|
|
{1:~ }|
|
|
|
|
{3: }|
|
|
|
|
:012345678901234567890123|
|
|
|
|
456789^ |
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2019-05-26 10:52:30 -07:00
|
|
|
command('call timer_start(0, {-> 1})')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2019-05-26 10:52:30 -07:00
|
|
|
|
|
|
|
|
{1:~ }|
|
|
|
|
{3: }|
|
|
|
|
:012345678901234567890123|
|
|
|
|
456789^ |
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
unchanged = true,
|
|
|
|
timeout = 100,
|
|
|
|
}
|
2019-05-26 10:52:30 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('with <Cmd>', function()
|
2022-11-21 17:13:30 -07:00
|
|
|
if is_os('bsd') then
|
2019-10-17 19:46:30 -07:00
|
|
|
pending('FIXME #10804')
|
2019-09-01 18:07:00 -07:00
|
|
|
end
|
2024-01-02 18:09:18 -07:00
|
|
|
command('cmap a <Cmd>call sin(0)<CR>') -- no-op
|
2019-05-26 10:52:30 -07:00
|
|
|
feed(':012345678901234567890123456789')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2019-05-26 10:52:30 -07:00
|
|
|
|
|
|
|
|
{1:~ }|
|
|
|
|
{3: }|
|
|
|
|
:012345678901234567890123|
|
|
|
|
456789^ |
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2019-05-26 10:52:30 -07:00
|
|
|
feed('a')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2019-05-26 10:52:30 -07:00
|
|
|
|
|
|
|
|
{1:~ }|
|
|
|
|
{3: }|
|
|
|
|
:012345678901234567890123|
|
|
|
|
456789^ |
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
unchanged = true,
|
|
|
|
}
|
2019-05-26 10:52:30 -07:00
|
|
|
end)
|
2022-06-15 04:41:58 -07:00
|
|
|
|
|
|
|
it('after pressing Ctrl-C in cmdwin in Visual mode #18967', function()
|
|
|
|
screen:try_resize(40, 10)
|
|
|
|
command('set cmdwinheight=3')
|
|
|
|
feed('q:iabc<Esc>vhh')
|
|
|
|
screen:expect([[
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2022-06-15 04:41:58 -07:00
|
|
|
{2:[No Name] }|
|
|
|
|
{1::}^a{8:bc} |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-06-15 04:41:58 -07:00
|
|
|
{3:[Command Line] }|
|
|
|
|
{9:-- VISUAL --} |
|
|
|
|
]])
|
|
|
|
feed('<C-C>')
|
|
|
|
screen:expect([[
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2022-06-15 04:41:58 -07:00
|
|
|
{2:[No Name] }|
|
|
|
|
{1::}a{8:bc} |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-06-15 04:41:58 -07:00
|
|
|
{3:[Command Line] }|
|
|
|
|
:^abc |
|
|
|
|
]])
|
|
|
|
end)
|
2023-10-31 13:33:00 -07:00
|
|
|
|
|
|
|
it('with rightleftcmd', function()
|
|
|
|
command('set rightleft rightleftcmd=search shortmess+=s')
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_buf_set_lines(0, 0, -1, true, { "let's rock!" })
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2023-10-31 13:33:00 -07:00
|
|
|
!kcor s'te^l|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1: ~}|*3
|
2023-10-31 13:33:00 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2023-10-31 13:33:00 -07:00
|
|
|
|
|
|
|
feed '/'
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2023-10-31 13:33:00 -07:00
|
|
|
!kcor s'tel|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1: ~}|*3
|
2023-10-31 13:33:00 -07:00
|
|
|
^ /|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2023-10-31 13:33:00 -07:00
|
|
|
|
|
|
|
feed "let's"
|
|
|
|
-- note: cursor looks off but looks alright in real use
|
|
|
|
-- when rendered as a block so it touches the end of the text
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2023-10-31 13:33:00 -07:00
|
|
|
!kcor {2:s'tel}|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1: ~}|*3
|
2023-10-31 13:33:00 -07:00
|
|
|
^ s'tel/|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2023-10-31 13:33:00 -07:00
|
|
|
|
|
|
|
-- cursor movement
|
2024-01-02 18:09:18 -07:00
|
|
|
feed '<space>'
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2023-10-31 13:33:00 -07:00
|
|
|
!kcor{2: s'tel}|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1: ~}|*3
|
2023-10-31 13:33:00 -07:00
|
|
|
^ s'tel/|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2023-10-31 13:33:00 -07:00
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
feed 'rock'
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2023-10-31 13:33:00 -07:00
|
|
|
!{2:kcor s'tel}|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1: ~}|*3
|
2023-10-31 13:33:00 -07:00
|
|
|
^ kcor s'tel/|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2023-10-31 13:33:00 -07:00
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
feed '<right>'
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2023-10-31 13:33:00 -07:00
|
|
|
!{2:kcor s'tel}|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1: ~}|*3
|
2023-10-31 13:33:00 -07:00
|
|
|
^kcor s'tel/|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2023-10-31 13:33:00 -07:00
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
feed '<left>'
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2023-10-31 13:33:00 -07:00
|
|
|
!{2:kcor s'tel}|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1: ~}|*3
|
2023-10-31 13:33:00 -07:00
|
|
|
^ kcor s'tel/|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2023-10-31 13:33:00 -07:00
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
feed '<cr>'
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2023-10-31 13:33:00 -07:00
|
|
|
!{10:kcor s'te^l}|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1: ~}|*3
|
2023-10-31 13:33:00 -07:00
|
|
|
kcor s'tel/ |
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2023-10-31 13:33:00 -07:00
|
|
|
end)
|
2019-05-26 10:52:30 -07:00
|
|
|
end)
|
2021-04-01 04:46:12 -07:00
|
|
|
|
2022-07-25 19:21:30 -07:00
|
|
|
describe('statusline is redrawn on entering cmdline', function()
|
|
|
|
local screen
|
|
|
|
|
|
|
|
before_each(function()
|
|
|
|
clear()
|
|
|
|
screen = new_screen()
|
|
|
|
command('set laststatus=2')
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('from normal mode', function()
|
|
|
|
command('set statusline=%{mode()}')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-07-25 19:21:30 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-07-25 19:21:30 -07:00
|
|
|
{3:n }|
|
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-07-25 19:21:30 -07:00
|
|
|
|
|
|
|
feed(':')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-07-25 19:21:30 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-07-25 19:21:30 -07:00
|
|
|
{3:c }|
|
|
|
|
:^ |
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-07-25 19:21:30 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('from normal mode when : is mapped', function()
|
|
|
|
command('set statusline=%{mode()}')
|
|
|
|
command('nnoremap ; :')
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-07-25 19:21:30 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-07-25 19:21:30 -07:00
|
|
|
{3:n }|
|
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-07-25 19:21:30 -07:00
|
|
|
|
|
|
|
feed(';')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-07-25 19:21:30 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-07-25 19:21:30 -07:00
|
|
|
{3:c }|
|
|
|
|
:^ |
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-07-25 19:21:30 -07:00
|
|
|
end)
|
|
|
|
|
2022-09-27 07:19:15 -07:00
|
|
|
it('with scrolled messages', function()
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:try_resize(35, 14)
|
2022-09-26 06:23:43 -07:00
|
|
|
exec([[
|
|
|
|
let g:count = 0
|
|
|
|
autocmd CmdlineEnter * let g:count += 1
|
|
|
|
split
|
|
|
|
resize 1
|
|
|
|
setlocal statusline=%{mode()}%{g:count}
|
|
|
|
setlocal winbar=%{mode()}%{g:count}
|
|
|
|
]])
|
2022-07-25 19:21:30 -07:00
|
|
|
feed(':echoerr doesnotexist<cr>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-09-26 06:23:43 -07:00
|
|
|
{9:c1 }|
|
2022-07-25 19:21:30 -07:00
|
|
|
|
|
2022-09-26 06:23:43 -07:00
|
|
|
{3:c1 }|
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*5
|
2022-07-25 19:21:30 -07:00
|
|
|
{3: }|
|
|
|
|
{4:E121: Undefined variable: doesnotex}|
|
|
|
|
{4:ist} |
|
|
|
|
{5:Press ENTER or type command to cont}|
|
|
|
|
{5:inue}^ |
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-07-25 19:21:30 -07:00
|
|
|
feed(':echoerr doesnotexist<cr>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-09-26 06:23:43 -07:00
|
|
|
{9:c2 }|
|
|
|
|
|
|
|
|
|
{3:c2 }|
|
2022-07-25 19:21:30 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-09-26 06:23:43 -07:00
|
|
|
{3: }|
|
|
|
|
{4:E121: Undefined variable: doesnotex}|
|
|
|
|
{4:ist} |
|
|
|
|
{5:Press ENTER or type command to cont}|
|
|
|
|
{4:E121: Undefined variable: doesnotex}|
|
|
|
|
{4:ist} |
|
|
|
|
{5:Press ENTER or type command to cont}|
|
|
|
|
{5:inue}^ |
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-09-26 06:23:43 -07:00
|
|
|
|
|
|
|
feed(':echoerr doesnotexist<cr>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-09-26 06:23:43 -07:00
|
|
|
{9:c3 }|
|
|
|
|
|
|
|
|
|
{3:c3 }|
|
2022-07-25 19:21:30 -07:00
|
|
|
{3: }|
|
|
|
|
{4:E121: Undefined variable: doesnotex}|
|
|
|
|
{4:ist} |
|
|
|
|
{5:Press ENTER or type command to cont}|
|
|
|
|
{4:E121: Undefined variable: doesnotex}|
|
|
|
|
{4:ist} |
|
|
|
|
{5:Press ENTER or type command to cont}|
|
2022-09-26 06:23:43 -07:00
|
|
|
{4:E121: Undefined variable: doesnotex}|
|
|
|
|
{4:ist} |
|
|
|
|
{5:Press ENTER or type command to cont}|
|
|
|
|
{5:inue}^ |
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-09-26 06:23:43 -07:00
|
|
|
|
|
|
|
feed('<cr>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-09-26 06:23:43 -07:00
|
|
|
{9:n3 }|
|
|
|
|
^ |
|
|
|
|
{3:n3 }|
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*8
|
2022-09-26 06:23:43 -07:00
|
|
|
{2:[No Name] }|
|
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-09-26 06:23:43 -07:00
|
|
|
end)
|
|
|
|
|
2022-07-25 19:21:30 -07:00
|
|
|
describe('if custom statusline is set by', function()
|
|
|
|
before_each(function()
|
|
|
|
command('set statusline=')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-07-25 19:21:30 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-07-25 19:21:30 -07:00
|
|
|
{3:[No Name] }|
|
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-07-25 19:21:30 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('CmdlineEnter autocommand', function()
|
|
|
|
command('autocmd CmdlineEnter * set statusline=command')
|
|
|
|
feed(':')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-07-25 19:21:30 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-07-25 19:21:30 -07:00
|
|
|
{3:command }|
|
|
|
|
:^ |
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-07-25 19:21:30 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('ModeChanged autocommand', function()
|
|
|
|
command('autocmd ModeChanged *:c set statusline=command')
|
|
|
|
feed(':')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-07-25 19:21:30 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-07-25 19:21:30 -07:00
|
|
|
{3:command }|
|
|
|
|
:^ |
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-07-25 19:21:30 -07:00
|
|
|
end)
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
2023-06-22 15:40:26 -07:00
|
|
|
it('tabline is not redrawn in Ex mode #24122', function()
|
|
|
|
clear()
|
|
|
|
local screen = Screen.new(60, 5)
|
|
|
|
screen:set_default_attr_ids({
|
2024-01-02 18:09:18 -07:00
|
|
|
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
|
|
|
|
[1] = { bold = true, reverse = true }, -- MsgSeparator
|
|
|
|
[2] = { reverse = true }, -- TabLineFill
|
2023-06-22 15:40:26 -07:00
|
|
|
})
|
|
|
|
screen:attach()
|
|
|
|
|
|
|
|
exec([[
|
|
|
|
set showtabline=2
|
|
|
|
set tabline=%!MyTabLine()
|
|
|
|
|
|
|
|
function! MyTabLine()
|
|
|
|
|
|
|
|
return "foo"
|
|
|
|
endfunction
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('gQ')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2023-06-22 15:40:26 -07:00
|
|
|
{2:foo }|
|
|
|
|
|
|
|
|
|
{1: }|
|
|
|
|
Entering Ex mode. Type "visual" to go to Normal mode. |
|
|
|
|
:^ |
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2023-06-22 15:40:26 -07:00
|
|
|
|
|
|
|
feed('echo 1<CR>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2023-06-22 15:40:26 -07:00
|
|
|
{1: }|
|
|
|
|
Entering Ex mode. Type "visual" to go to Normal mode. |
|
|
|
|
:echo 1 |
|
|
|
|
1 |
|
|
|
|
:^ |
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2023-06-22 15:40:26 -07:00
|
|
|
end)
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
describe('cmdline height', function()
|
2023-07-24 03:56:26 -07:00
|
|
|
before_each(clear)
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
it('does not crash resized screen #14263', function()
|
2021-04-01 04:46:12 -07:00
|
|
|
local screen = Screen.new(25, 10)
|
|
|
|
screen:attach()
|
|
|
|
command('set cmdheight=9999')
|
|
|
|
screen:try_resize(25, 5)
|
|
|
|
assert_alive()
|
|
|
|
end)
|
2023-07-24 03:56:26 -07:00
|
|
|
|
2023-08-17 15:16:19 -07:00
|
|
|
it('unchanged when restoring window sizes with global statusline', function()
|
|
|
|
command('set cmdheight=2 laststatus=2')
|
2023-07-24 03:56:26 -07:00
|
|
|
feed('q:')
|
2023-08-17 15:16:19 -07:00
|
|
|
command('set cmdheight=1 laststatus=3 | quit')
|
|
|
|
-- Available lines changed, so closing cmdwin should skip restoring window sizes, leaving the
|
|
|
|
-- cmdheight unchanged.
|
2023-07-24 03:56:26 -07:00
|
|
|
eq(1, eval('&cmdheight'))
|
|
|
|
end)
|
2021-04-01 04:46:12 -07:00
|
|
|
end)
|
2022-06-13 02:40:51 -07:00
|
|
|
|
|
|
|
describe('cmdheight=0', function()
|
|
|
|
local screen
|
|
|
|
before_each(function()
|
|
|
|
clear()
|
|
|
|
screen = Screen.new(25, 5)
|
2022-09-16 10:21:32 -07:00
|
|
|
screen:set_default_attr_ids {
|
2024-01-02 18:09:18 -07:00
|
|
|
[1] = { bold = true, foreground = Screen.colors.Blue },
|
|
|
|
[2] = { bold = true, reverse = true },
|
|
|
|
[3] = { bold = true },
|
|
|
|
[4] = { foreground = Screen.colors.White, background = Screen.colors.Red },
|
|
|
|
[5] = { foreground = Screen.colors.SeaGreen4, bold = true },
|
|
|
|
[6] = { reverse = true },
|
|
|
|
[7] = { background = Screen.colors.Yellow },
|
2022-09-16 10:21:32 -07:00
|
|
|
}
|
2022-06-13 02:40:51 -07:00
|
|
|
screen:attach()
|
|
|
|
end)
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
it('with redrawdebug=invalid resize -1', function()
|
|
|
|
command('set redrawdebug=invalid cmdheight=0 noruler laststatus=0')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2023-09-24 11:15:33 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
|
|
|
feed(':resize -1<CR>')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2023-09-24 11:15:33 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2023-09-24 11:15:33 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2023-09-24 11:15:33 -07:00
|
|
|
assert_alive()
|
|
|
|
end)
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
it('with cmdheight=1 noruler laststatus=2', function()
|
|
|
|
command('set cmdheight=1 noruler laststatus=2')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-06-13 02:40:51 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-09-16 10:21:32 -07:00
|
|
|
{2:[No Name] }|
|
2022-06-13 02:40:51 -07:00
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-06-13 02:40:51 -07:00
|
|
|
end)
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
it('with cmdheight=0 noruler laststatus=2', function()
|
|
|
|
command('set cmdheight=0 noruler laststatus=2')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-06-13 02:40:51 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2022-09-16 10:21:32 -07:00
|
|
|
{2:[No Name] }|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-06-13 02:40:51 -07:00
|
|
|
end)
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
it('with cmdheight=0 ruler laststatus=0', function()
|
|
|
|
command('set cmdheight=0 ruler laststatus=0')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-06-13 02:40:51 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-06-13 02:40:51 -07:00
|
|
|
end)
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
it('with cmdheight=0 ruler laststatus=0', function()
|
|
|
|
command('set cmdheight=0 noruler laststatus=0 showmode')
|
2022-06-13 02:40:51 -07:00
|
|
|
feed('i')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-06-13 02:40:51 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
showmode = {},
|
|
|
|
}
|
2022-06-13 02:40:51 -07:00
|
|
|
feed('<Esc>')
|
|
|
|
eq(0, eval('&cmdheight'))
|
|
|
|
end)
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
it('with cmdheight=0 ruler rulerformat laststatus=0', function()
|
|
|
|
command('set cmdheight=0 noruler laststatus=0 rulerformat=%l,%c%= showmode')
|
2022-06-30 18:59:50 -07:00
|
|
|
feed('i')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-06-30 18:59:50 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
showmode = {},
|
|
|
|
}
|
2022-06-30 18:59:50 -07:00
|
|
|
feed('<Esc>')
|
|
|
|
eq(0, eval('&cmdheight'))
|
|
|
|
end)
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
it('with showmode', function()
|
|
|
|
command('set cmdheight=1 noruler laststatus=0 showmode')
|
2022-06-13 02:40:51 -07:00
|
|
|
feed('i')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-06-13 02:40:51 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2022-09-16 10:21:32 -07:00
|
|
|
{3:-- INSERT --} |
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-06-13 02:40:51 -07:00
|
|
|
feed('<Esc>')
|
|
|
|
eq(1, eval('&cmdheight'))
|
|
|
|
end)
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
it('when using command line', function()
|
|
|
|
command('set cmdheight=0 noruler laststatus=0')
|
2022-06-13 02:40:51 -07:00
|
|
|
feed(':')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-06-13 02:40:51 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2022-06-13 02:40:51 -07:00
|
|
|
:^ |
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-09-13 03:56:30 -07:00
|
|
|
eq(0, eval('&cmdheight'))
|
2022-06-13 02:40:51 -07:00
|
|
|
feed('<cr>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-06-13 02:40:51 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
showmode = {},
|
|
|
|
}
|
2022-06-13 02:40:51 -07:00
|
|
|
eq(0, eval('&cmdheight'))
|
|
|
|
end)
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
it('when using input()', function()
|
|
|
|
command('set cmdheight=0 noruler laststatus=0')
|
2022-06-13 02:40:51 -07:00
|
|
|
feed(':call input("foo >")<cr>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-06-13 02:40:51 -07:00
|
|
|
|
|
2022-09-16 10:21:32 -07:00
|
|
|
{1:~ }|
|
|
|
|
{2: }|
|
2022-09-13 03:56:30 -07:00
|
|
|
:call input("foo >") |
|
2022-06-13 02:40:51 -07:00
|
|
|
foo >^ |
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-09-13 03:56:30 -07:00
|
|
|
eq(0, eval('&cmdheight'))
|
2022-06-13 02:40:51 -07:00
|
|
|
feed('<cr>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-06-13 02:40:51 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
showmode = {},
|
|
|
|
}
|
2022-06-13 02:40:51 -07:00
|
|
|
eq(0, eval('&cmdheight'))
|
|
|
|
end)
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
it('with winbar and splits', function()
|
|
|
|
command('set cmdheight=0 noruler laststatus=3 winbar=foo')
|
2022-06-13 02:40:51 -07:00
|
|
|
feed(':split<CR>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-09-16 10:21:32 -07:00
|
|
|
{2: }|
|
2022-09-13 03:56:30 -07:00
|
|
|
:split |
|
2022-09-16 10:21:32 -07:00
|
|
|
{4:E36: Not enough room} |
|
|
|
|
{5:Press ENTER or type comma}|
|
|
|
|
{5:nd to continue}^ |
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-06-13 02:40:51 -07:00
|
|
|
feed('<CR>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-09-16 10:21:32 -07:00
|
|
|
{3:foo }|
|
2022-06-13 02:40:51 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-09-16 10:21:32 -07:00
|
|
|
{2:[No Name] }|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-06-13 02:40:51 -07:00
|
|
|
feed(':')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-09-16 10:21:32 -07:00
|
|
|
{3:foo }|
|
2022-06-13 02:40:51 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-06-13 02:40:51 -07:00
|
|
|
:^ |
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-06-13 02:40:51 -07:00
|
|
|
feed('<Esc>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-09-16 10:21:32 -07:00
|
|
|
{3:foo }|
|
2022-06-13 02:40:51 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-09-16 10:21:32 -07:00
|
|
|
{2:[No Name] }|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
showmode = {},
|
|
|
|
}
|
2022-06-13 02:40:51 -07:00
|
|
|
eq(0, eval('&cmdheight'))
|
|
|
|
|
|
|
|
assert_alive()
|
|
|
|
end)
|
2022-06-30 18:59:50 -07:00
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
it('when macro with lastline', function()
|
|
|
|
command('set cmdheight=0 display=lastline')
|
2022-06-30 18:59:50 -07:00
|
|
|
feed('qq')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-06-30 18:59:50 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-06-30 18:59:50 -07:00
|
|
|
feed('q')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-06-30 18:59:50 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
unchanged = true,
|
|
|
|
}
|
2022-06-30 18:59:50 -07:00
|
|
|
end)
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
it('when substitute text', function()
|
|
|
|
command('set cmdheight=0 noruler laststatus=3')
|
2022-06-30 18:59:50 -07:00
|
|
|
feed('ifoo<ESC>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-06-30 18:59:50 -07:00
|
|
|
fo^o |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2022-09-16 10:21:32 -07:00
|
|
|
{2:[No Name] [+] }|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-06-30 18:59:50 -07:00
|
|
|
|
|
|
|
feed(':%s/foo/bar/gc<CR>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-09-16 10:21:32 -07:00
|
|
|
{6:foo} |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2022-09-16 10:21:32 -07:00
|
|
|
{5:replace wi...q/l/^E/^Y)?}^ |
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-06-30 18:59:50 -07:00
|
|
|
|
|
|
|
feed('y')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-06-30 18:59:50 -07:00
|
|
|
^bar |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2022-09-16 10:21:32 -07:00
|
|
|
{2:[No Name] [+] }|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-06-30 18:59:50 -07:00
|
|
|
|
|
|
|
assert_alive()
|
|
|
|
end)
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
it('when window resize', function()
|
|
|
|
command('set cmdheight=0')
|
2022-06-30 18:59:50 -07:00
|
|
|
feed('<C-w>+')
|
|
|
|
eq(0, eval('&cmdheight'))
|
|
|
|
end)
|
2022-09-16 10:21:32 -07:00
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
it('with non-silent mappings with cmdline', function()
|
|
|
|
command('set cmdheight=0')
|
|
|
|
command('map <f3> :nohlsearch<cr>')
|
2022-09-16 10:21:32 -07:00
|
|
|
feed('iaabbaa<esc>/aa<cr>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-09-16 10:21:32 -07:00
|
|
|
{7:^aa}bb{7:aa} |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-09-16 10:21:32 -07:00
|
|
|
|
|
|
|
feed('<f3>')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-09-16 10:21:32 -07:00
|
|
|
^aabbaa |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-09-16 10:21:32 -07:00
|
|
|
end)
|
2022-09-26 01:40:34 -07:00
|
|
|
|
|
|
|
it('with silent! at startup', function()
|
2024-01-02 18:09:18 -07:00
|
|
|
clear { args = { '-c', 'set cmdheight=0', '-c', 'autocmd VimEnter * silent! call Foo()' } }
|
2022-09-26 01:40:34 -07:00
|
|
|
screen:attach()
|
|
|
|
-- doesn't crash while not displaying silent! error message
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-09-26 01:40:34 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-09-26 01:40:34 -07:00
|
|
|
end)
|
2022-09-26 02:40:06 -07:00
|
|
|
|
|
|
|
it('with multigrid', function()
|
2024-01-02 18:09:18 -07:00
|
|
|
clear { args = { '--cmd', 'set cmdheight=0' } }
|
|
|
|
screen:attach { ext_multigrid = true }
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_buf_set_lines(0, 0, -1, true, { 'p' })
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-09-26 02:40:06 -07:00
|
|
|
## grid 1
|
2023-12-09 05:42:00 -07:00
|
|
|
[2:-------------------------]|*5
|
2022-09-26 02:40:06 -07:00
|
|
|
## grid 2
|
2023-09-20 12:51:57 -07:00
|
|
|
^p |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2022-09-26 02:40:06 -07:00
|
|
|
## grid 3
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
win_viewport = {
|
|
|
|
[2] = {
|
2024-01-16 06:26:21 -07:00
|
|
|
win = 1000,
|
2024-01-02 18:09:18 -07:00
|
|
|
topline = 0,
|
|
|
|
botline = 2,
|
|
|
|
curline = 0,
|
|
|
|
curcol = 0,
|
|
|
|
linecount = 1,
|
|
|
|
sum_scroll_delta = 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2022-09-26 02:40:06 -07:00
|
|
|
|
|
|
|
feed '/p'
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2022-09-26 02:40:06 -07:00
|
|
|
## grid 1
|
2023-12-09 05:42:00 -07:00
|
|
|
[2:-------------------------]|*4
|
2022-09-26 02:40:06 -07:00
|
|
|
[3:-------------------------]|
|
|
|
|
## grid 2
|
2023-09-20 12:51:57 -07:00
|
|
|
{6:p} |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2022-09-26 02:40:06 -07:00
|
|
|
## grid 3
|
|
|
|
/p^ |
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
win_viewport = {
|
|
|
|
[2] = {
|
2024-01-16 06:26:21 -07:00
|
|
|
win = 1000,
|
2024-01-02 18:09:18 -07:00
|
|
|
topline = 0,
|
|
|
|
botline = 2,
|
|
|
|
curline = 0,
|
|
|
|
curcol = 0,
|
|
|
|
linecount = 1,
|
|
|
|
sum_scroll_delta = 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2022-09-26 02:40:06 -07:00
|
|
|
end)
|
2022-09-26 06:23:43 -07:00
|
|
|
|
|
|
|
it('winbar is redrawn on entering cmdline and :redrawstatus #20336', function()
|
|
|
|
exec([[
|
|
|
|
set cmdheight=0
|
|
|
|
set winbar=%{mode()}%=:%{getcmdline()}
|
|
|
|
]])
|
|
|
|
feed(':')
|
|
|
|
screen:expect([[
|
|
|
|
{3:c :}|
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-09-26 06:23:43 -07:00
|
|
|
:^ |
|
|
|
|
]])
|
|
|
|
feed('echo')
|
|
|
|
-- not redrawn yet
|
|
|
|
screen:expect([[
|
|
|
|
{3:c :}|
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-09-26 06:23:43 -07:00
|
|
|
:echo^ |
|
|
|
|
]])
|
|
|
|
command('redrawstatus')
|
|
|
|
screen:expect([[
|
|
|
|
{3:c :echo}|
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-09-26 06:23:43 -07:00
|
|
|
:echo^ |
|
|
|
|
]])
|
|
|
|
end)
|
2022-09-27 15:22:11 -07:00
|
|
|
|
|
|
|
it('window equalization with laststatus=0 #20367', function()
|
|
|
|
screen:try_resize(60, 9)
|
|
|
|
command('set cmdheight=0 laststatus=0')
|
|
|
|
command('vsplit')
|
|
|
|
screen:expect([[
|
|
|
|
^ │ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }│{1:~ }|*8
|
2022-09-27 15:22:11 -07:00
|
|
|
]])
|
|
|
|
feed(':')
|
|
|
|
command('split')
|
|
|
|
feed('<Esc>')
|
|
|
|
screen:expect([[
|
|
|
|
^ │ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }│{1:~ }|*3
|
2022-09-27 15:22:11 -07:00
|
|
|
{2:[No Name] }│{1:~ }|
|
|
|
|
│{1:~ }|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }│{1:~ }|*3
|
2022-09-27 15:22:11 -07:00
|
|
|
]])
|
|
|
|
command('resize 2')
|
|
|
|
screen:expect([[
|
|
|
|
^ │ |
|
|
|
|
{1:~ }│{1:~ }|
|
|
|
|
{2:[No Name] }│{1:~ }|
|
|
|
|
│{1:~ }|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }│{1:~ }|*5
|
2022-09-27 15:22:11 -07:00
|
|
|
]])
|
|
|
|
feed(':')
|
|
|
|
command('wincmd =')
|
|
|
|
feed('<Esc>')
|
|
|
|
screen:expect([[
|
|
|
|
^ │ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }│{1:~ }|*3
|
2022-09-27 15:22:11 -07:00
|
|
|
{2:[No Name] }│{1:~ }|
|
|
|
|
│{1:~ }|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }│{1:~ }|*3
|
2022-09-27 15:22:11 -07:00
|
|
|
]])
|
|
|
|
end)
|
2022-12-25 23:04:46 -07:00
|
|
|
|
|
|
|
it('no assert failure with showcmd', function()
|
|
|
|
command('set showcmd cmdheight=0')
|
|
|
|
feed('d')
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2022-12-25 23:04:46 -07:00
|
|
|
]])
|
|
|
|
assert_alive()
|
|
|
|
end)
|
2022-12-30 17:30:05 -07:00
|
|
|
|
|
|
|
it('can only be resized to 0 if set explicitly', function()
|
|
|
|
command('set laststatus=2')
|
|
|
|
command('resize +1')
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-12-30 17:30:05 -07:00
|
|
|
{2:[No Name] }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
command('set cmdheight=0')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2023-09-20 12:51:57 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2023-09-20 12:51:57 -07:00
|
|
|
{2:[No Name] }|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-12-30 17:30:05 -07:00
|
|
|
command('resize -1')
|
2024-01-02 18:09:18 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2023-09-20 12:51:57 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2023-09-20 12:51:57 -07:00
|
|
|
{2:[No Name] }|
|
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-12-30 17:30:05 -07:00
|
|
|
command('resize +1')
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2022-12-30 17:30:05 -07:00
|
|
|
{2:[No Name] }|
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
2024-01-02 18:09:18 -07:00
|
|
|
it('cannot be resized at all with external messages', function()
|
2022-12-30 17:30:05 -07:00
|
|
|
clear()
|
2024-01-02 18:09:18 -07:00
|
|
|
screen = new_screen({ rgb = true, ext_messages = true })
|
2023-01-12 20:47:55 -07:00
|
|
|
command('set laststatus=2 mouse=a')
|
2022-12-30 17:30:05 -07:00
|
|
|
command('resize -1')
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2022-12-30 17:30:05 -07:00
|
|
|
{3:[No Name] }|
|
|
|
|
]])
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'press', '', 0, 6, 10)
|
2023-01-12 21:25:19 -07:00
|
|
|
poke_eventloop()
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'drag', '', 0, 5, 10)
|
2023-01-12 20:47:55 -07:00
|
|
|
screen:expect_unchanged()
|
2022-12-30 17:30:05 -07:00
|
|
|
end)
|
2022-06-13 02:40:51 -07:00
|
|
|
end)
|