2024-04-20 08:44:13 -07:00
|
|
|
local t = require('test.testutil')
|
|
|
|
local n = require('test.functional.testnvim')()
|
2017-02-24 00:26:39 -07:00
|
|
|
local Screen = require('test.functional.ui.screen')
|
2024-04-20 08:44:13 -07:00
|
|
|
|
|
|
|
local clear, feed = n.clear, n.feed
|
|
|
|
local source = n.source
|
|
|
|
local command = n.command
|
|
|
|
local assert_alive = n.assert_alive
|
|
|
|
local poke_eventloop = n.poke_eventloop
|
|
|
|
local exec = n.exec
|
|
|
|
local eval = n.eval
|
2024-04-08 02:03:20 -07:00
|
|
|
local eq = t.eq
|
|
|
|
local is_os = t.is_os
|
2024-04-20 08:44:13 -07:00
|
|
|
local api = n.api
|
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()
|
2024-11-11 14:15:19 -07:00
|
|
|
screen = Screen.new(25, 5, { 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(':')
|
2018-08-20 09:51:25 -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
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]],
|
|
|
|
cmdline = { {
|
|
|
|
firstc = ':',
|
|
|
|
content = { { '' } },
|
|
|
|
pos = 0,
|
2024-01-02 18:09:18 -07:00
|
|
|
} },
|
2018-08-20 09:51:25 -07:00
|
|
|
}
|
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
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2018-08-20 09:51:25 -07:00
|
|
|
firstc = ':',
|
|
|
|
content = { { 'sign' } },
|
|
|
|
pos = 4,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
}
|
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
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2018-08-20 09:51:25 -07:00
|
|
|
firstc = ':',
|
|
|
|
content = { { 'sign' } },
|
|
|
|
pos = 3,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
}
|
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
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2018-08-20 09:51:25 -07:00
|
|
|
firstc = ':',
|
|
|
|
content = { { 'sin' } },
|
|
|
|
pos = 2,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
}
|
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
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
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
|
|
|
|
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
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2018-08-20 09:51:25 -07:00
|
|
|
prompt = 'input',
|
|
|
|
content = { { 'default' } },
|
|
|
|
pos = 7,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
}
|
|
|
|
|
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
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
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
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2018-08-20 09:51:25 -07:00
|
|
|
firstc = ':',
|
|
|
|
content = { { 'xx' } },
|
|
|
|
pos = 2,
|
|
|
|
special = { '"', true },
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
}
|
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
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2018-08-20 09:51:25 -07:00
|
|
|
firstc = ':',
|
|
|
|
content = { { 'xx' } },
|
|
|
|
pos = 2,
|
|
|
|
special = { '"', true },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
firstc = '=',
|
|
|
|
content = { { '' } },
|
|
|
|
pos = 0,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
}
|
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 = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2018-08-20 09:51:25 -07:00
|
|
|
firstc = ':',
|
|
|
|
content = { { 'xx' } },
|
|
|
|
pos = 2,
|
|
|
|
special = { '"', true },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
firstc = '=',
|
2024-11-09 06:14:29 -07:00
|
|
|
content = { { '1', 26 }, { '+', 15 }, { '2', 26 } },
|
2018-08-20 09:51:25 -07:00
|
|
|
pos = 3,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
}
|
2024-01-02 18:09:18 -07:00
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
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
|
|
|
|
|
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
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
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
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2018-07-06 05:39:50 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2018-08-20 09:51:25 -07:00
|
|
|
firstc = ':',
|
|
|
|
content = { { 'xx3' } },
|
|
|
|
pos = 3,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
}
|
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
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
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
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2018-08-20 09:51:25 -07:00
|
|
|
indent = 2,
|
|
|
|
firstc = ':',
|
|
|
|
content = { { '' } },
|
|
|
|
pos = 0,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
},
|
|
|
|
cmdline_block = {
|
|
|
|
{ { 'function Foo()' } },
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
}
|
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
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-08-17 03:26:33 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2018-08-20 09:51:25 -07:00
|
|
|
indent = 2,
|
|
|
|
firstc = ':',
|
|
|
|
content = { { '' } },
|
|
|
|
pos = 0,
|
|
|
|
},
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
cmdline_block = {
|
|
|
|
{ { 'function Foo()' } },
|
|
|
|
{ { ' line1' } },
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
}
|
2024-01-02 18:09:18 -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
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2018-07-06 05:39:50 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2018-08-20 09:51:25 -07:00
|
|
|
indent = 2,
|
|
|
|
firstc = ':',
|
|
|
|
content = { { '' } },
|
|
|
|
pos = 0,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
},
|
|
|
|
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
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2018-02-13 11:47:27 -07:00
|
|
|
|
|
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
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2018-02-13 11:47:27 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2018-08-20 09:51:25 -07:00
|
|
|
indent = 2,
|
|
|
|
firstc = ':',
|
|
|
|
content = { { '' } },
|
|
|
|
pos = 0,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
},
|
|
|
|
cmdline_block = {
|
|
|
|
{ { 'function Bar()' } },
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
}
|
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
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
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
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-08-27 00:57:30 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2018-08-20 09:51:25 -07:00
|
|
|
firstc = ':',
|
|
|
|
content = { { 'make' } },
|
|
|
|
pos = 4,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
}
|
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] }|
|
2024-04-02 04:08:03 -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
|
|
|
]],
|
|
|
|
}
|
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] }|
|
2024-04-02 04:08:03 -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 = {
|
|
|
|
nil,
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2018-08-20 09:51:25 -07:00
|
|
|
firstc = ':',
|
|
|
|
content = { { 'yank' } },
|
|
|
|
pos = 4,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
}
|
2024-01-02 18:09:18 -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] }|
|
2024-04-02 04:08:03 -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,
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2018-08-20 09:51:25 -07:00
|
|
|
firstc = ':',
|
|
|
|
content = { { 'yank' } },
|
|
|
|
pos = 4,
|
2017-06-26 05:49:15 -07:00
|
|
|
},
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
2017-06-26 05:49:15 -07:00
|
|
|
reset = true,
|
|
|
|
}
|
2024-01-02 18:09:18 -07:00
|
|
|
|
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] }|
|
2024-04-02 04:08:03 -07:00
|
|
|
{1::}make^ |
|
2017-12-05 05:16:56 -07:00
|
|
|
{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 = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2018-08-20 09:51:25 -07:00
|
|
|
firstc = ':',
|
|
|
|
content = { { 'make' } },
|
|
|
|
pos = 4,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
}
|
2024-01-02 18:09:18 -07:00
|
|
|
|
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
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2018-07-06 05:39:50 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2018-08-20 09:51:25 -07:00
|
|
|
firstc = ':',
|
|
|
|
content = { { 'make' } },
|
|
|
|
pos = 4,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
}
|
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
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-08-29 23:51:39 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2018-08-20 09:51:25 -07:00
|
|
|
prompt = 'secret:',
|
|
|
|
content = { { '******' } },
|
|
|
|
pos = 6,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
}
|
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>
|
|
|
|
]])
|
|
|
|
feed('<f5>(a(b)a)')
|
2018-08-20 09:51:25 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2017-12-05 05:16:56 -07:00
|
|
|
^ |
|
2024-11-09 06:14:29 -07:00
|
|
|
{1:~ }|*3
|
2017-12-05 05:16:56 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2018-08-20 09:51:25 -07:00
|
|
|
prompt = '>',
|
|
|
|
content = {
|
2024-11-09 06:14:29 -07:00
|
|
|
{ '(', 30 },
|
2018-08-20 09:51:25 -07:00
|
|
|
{ 'a' },
|
2024-11-09 06:14:29 -07:00
|
|
|
{ '(', 10 },
|
2018-08-20 09:51:25 -07:00
|
|
|
{ 'b' },
|
2024-11-09 06:14:29 -07:00
|
|
|
{ ')', 10 },
|
2018-08-20 09:51:25 -07:00
|
|
|
{ 'a' },
|
2024-11-09 06:14:29 -07:00
|
|
|
{ ')', 30 },
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
pos = 7,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
}
|
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
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-12-05 05:27:06 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2018-08-20 09:51:25 -07:00
|
|
|
firstc = ':',
|
|
|
|
content = { { 'sign define' } },
|
|
|
|
pos = 11,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
},
|
|
|
|
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
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-12-05 05:27:06 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2018-08-20 09:51:25 -07:00
|
|
|
firstc = ':',
|
|
|
|
content = { { 'sign jump' } },
|
|
|
|
pos = 9,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
},
|
|
|
|
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
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-12-05 05:27:06 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2018-08-20 09:51:25 -07:00
|
|
|
firstc = ':',
|
|
|
|
content = { { 'sign ' } },
|
|
|
|
pos = 5,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
},
|
|
|
|
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
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-12-05 05:27:06 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2018-08-20 09:51:25 -07:00
|
|
|
firstc = ':',
|
|
|
|
content = { { 'sign define' } },
|
|
|
|
pos = 11,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
},
|
|
|
|
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
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2017-12-05 05:27:06 -07:00
|
|
|
|
|
2018-08-20 09:51:25 -07:00
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2018-08-20 09:51:25 -07:00
|
|
|
firstc = ':',
|
|
|
|
content = { { 'sign definea' } },
|
|
|
|
pos = 12,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
|
|
|
},
|
2018-08-20 09:51:25 -07:00
|
|
|
}
|
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 = {
|
|
|
|
{ 'define', '', '', '' },
|
|
|
|
{ 'jump', '', '', '' },
|
|
|
|
{ 'list', '', '', '' },
|
|
|
|
{ 'place', '', '', '' },
|
|
|
|
{ 'undefine', '', '', '' },
|
|
|
|
{ 'unplace', '', '', '' },
|
|
|
|
}
|
|
|
|
|
|
|
|
command('set wildmode=full')
|
|
|
|
command('set wildmenu')
|
|
|
|
screen:set_option('ext_popupmenu', true)
|
|
|
|
feed(':sign <tab>')
|
|
|
|
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2019-03-04 02:59:44 -07:00
|
|
|
|
|
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2019-03-04 02:59:44 -07:00
|
|
|
firstc = ':',
|
|
|
|
content = { { 'sign define' } },
|
|
|
|
pos = 11,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
|
|
|
},
|
2019-03-04 02:59:44 -07:00
|
|
|
popupmenu = { items = expected, pos = 0, anchor = { -1, 0, 5 } },
|
2024-01-02 18:09:18 -07:00
|
|
|
}
|
2019-03-04 02:59:44 -07:00
|
|
|
|
|
|
|
feed('<tab>')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2019-03-04 02:59:44 -07:00
|
|
|
|
|
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2019-03-04 02:59:44 -07:00
|
|
|
firstc = ':',
|
|
|
|
content = { { 'sign jump' } },
|
|
|
|
pos = 9,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
|
|
|
},
|
2019-03-04 02:59:44 -07:00
|
|
|
popupmenu = { items = expected, pos = 1, anchor = { -1, 0, 5 } },
|
2024-01-02 18:09:18 -07:00
|
|
|
}
|
2019-03-04 02:59:44 -07:00
|
|
|
|
|
|
|
feed('<left><left>')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2019-03-04 02:59:44 -07:00
|
|
|
|
|
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2019-03-04 02:59:44 -07:00
|
|
|
firstc = ':',
|
|
|
|
content = { { 'sign ' } },
|
|
|
|
pos = 5,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
|
|
|
},
|
2019-03-04 02:59:44 -07:00
|
|
|
popupmenu = { items = expected, pos = -1, anchor = { -1, 0, 5 } },
|
2024-01-02 18:09:18 -07:00
|
|
|
}
|
2019-03-04 02:59:44 -07:00
|
|
|
|
|
|
|
feed('<right>')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2019-03-04 02:59:44 -07:00
|
|
|
|
|
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2019-03-04 02:59:44 -07:00
|
|
|
firstc = ':',
|
|
|
|
content = { { 'sign define' } },
|
|
|
|
pos = 11,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
|
|
|
},
|
2019-03-04 02:59:44 -07:00
|
|
|
popupmenu = { items = expected, pos = 0, anchor = { -1, 0, 5 } },
|
2024-01-02 18:09:18 -07:00
|
|
|
}
|
2019-03-04 02:59:44 -07:00
|
|
|
|
|
|
|
feed('a')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2019-03-04 02:59:44 -07:00
|
|
|
|
|
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2019-03-04 02:59:44 -07:00
|
|
|
firstc = ':',
|
|
|
|
content = { { 'sign definea' } },
|
|
|
|
pos = 12,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
|
|
|
},
|
2019-03-04 02:59:44 -07:00
|
|
|
}
|
|
|
|
feed('<esc>')
|
|
|
|
|
|
|
|
-- check positioning with multibyte char in pattern
|
|
|
|
command('e långfile1')
|
|
|
|
command('sp långfile2')
|
|
|
|
feed(':b lå<tab>')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
|
|
|
{3:långfile2 }|
|
|
|
|
|
|
|
|
|
{2:långfile1 }|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
popupmenu = {
|
|
|
|
anchor = { -1, 0, 2 },
|
|
|
|
items = { { 'långfile1', '', '', '' }, { 'långfile2', '', '', '' } },
|
|
|
|
pos = 0,
|
|
|
|
},
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2019-03-04 02:59:44 -07:00
|
|
|
content = { { 'b långfile1' } },
|
|
|
|
firstc = ':',
|
|
|
|
pos = 12,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
|
|
|
},
|
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>')
|
|
|
|
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2019-03-04 02:59:44 -07:00
|
|
|
|
|
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2019-03-04 02:59:44 -07:00
|
|
|
firstc = ':',
|
|
|
|
content = { { 'sign define' } },
|
|
|
|
pos = 11,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
2019-03-04 02:59:44 -07:00
|
|
|
},
|
|
|
|
wildmenu_items = expected,
|
|
|
|
wildmenu_pos = 0,
|
|
|
|
}
|
|
|
|
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')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2019-06-25 22:22:19 -07:00
|
|
|
|
|
|
|
|
]],
|
|
|
|
cmdline = {
|
2024-01-02 18:09:18 -07:00
|
|
|
{
|
2019-06-25 22:22:19 -07:00
|
|
|
content = { { 'x' } },
|
|
|
|
firstc = ':',
|
|
|
|
pos = 1,
|
|
|
|
special = { 'a', false },
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
|
|
|
},
|
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)
|
2024-03-14 16:39:44 -07:00
|
|
|
|
2024-04-10 02:42:46 -07:00
|
|
|
it('does not move cursor to curwin #20309', function()
|
2024-03-14 16:39:44 -07:00
|
|
|
local win = api.nvim_get_current_win()
|
|
|
|
command('norm icmdlinewin')
|
|
|
|
command('new')
|
|
|
|
command('norm icurwin')
|
|
|
|
feed(':')
|
|
|
|
api.nvim_win_set_cursor(win, { 1, 7 })
|
2024-04-10 02:42:46 -07:00
|
|
|
api.nvim__redraw({ win = win, cursor = true })
|
2024-03-14 16:39:44 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
curwin |
|
|
|
|
{3:[No Name] [+] }|
|
|
|
|
cmdline^win |
|
|
|
|
{2:[No Name] [+] }|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
cmdline = { {
|
|
|
|
content = { { '' } },
|
|
|
|
firstc = ':',
|
|
|
|
pos = 0,
|
|
|
|
} },
|
|
|
|
}
|
|
|
|
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
|
|
|
|
describe('ui/ext_cmdline', function()
|
|
|
|
test_cmdline(true)
|
|
|
|
end)
|
|
|
|
describe('ui/ext_cmdline (legacy highlights)', function()
|
|
|
|
test_cmdline(false)
|
|
|
|
end)
|
|
|
|
|
2019-05-26 10:52:30 -07:00
|
|
|
describe('cmdline redraw', function()
|
|
|
|
local screen
|
|
|
|
before_each(function()
|
|
|
|
clear()
|
2024-11-11 14:15:19 -07:00
|
|
|
screen = Screen.new(25, 5, { rgb = true })
|
2019-05-26 10:52:30 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('with timer', function()
|
|
|
|
feed(':012345678901234567890123456789')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
|
|
|
|
|
{1:~ }|
|
|
|
|
{3: }|
|
|
|
|
:012345678901234567890123|
|
|
|
|
456789^ |
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
command('call timer_start(0, {-> 1})')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
|
|
|
|
|
{1:~ }|
|
|
|
|
{3: }|
|
|
|
|
:012345678901234567890123|
|
|
|
|
456789^ |
|
|
|
|
]],
|
|
|
|
unchanged = true,
|
|
|
|
timeout = 100,
|
|
|
|
}
|
|
|
|
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
|
2019-08-10 02:46:26 -07:00
|
|
|
command('cmap a <Cmd>call sin(0)<CR>') -- no-op
|
2019-05-26 10:52:30 -07:00
|
|
|
feed(':012345678901234567890123456789')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
|
|
|
|
|
{1:~ }|
|
|
|
|
{3: }|
|
|
|
|
:012345678901234567890123|
|
|
|
|
456789^ |
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
feed('a')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
|
|
|
|
|
{1:~ }|
|
|
|
|
{3: }|
|
|
|
|
:012345678901234567890123|
|
|
|
|
456789^ |
|
|
|
|
]],
|
|
|
|
unchanged = true,
|
|
|
|
}
|
|
|
|
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] }|
|
2024-11-09 06:14:29 -07:00
|
|
|
{1::}^a{17:bc} |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-06-15 04:41:58 -07:00
|
|
|
{3:[Command Line] }|
|
2024-11-09 06:14:29 -07:00
|
|
|
{5:-- VISUAL --} |
|
2022-06-15 04:41:58 -07:00
|
|
|
]])
|
|
|
|
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] }|
|
2024-11-09 06:14:29 -07:00
|
|
|
{1::}a{17: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!" })
|
2023-10-31 13:33:00 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
!kcor s'te^l|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1: ~}|*3
|
2023-10-31 13:33:00 -07:00
|
|
|
|
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
|
|
|
|
feed '/'
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
!kcor s'tel|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1: ~}|*3
|
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
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
!kcor {2:s'tel}|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1: ~}|*3
|
2023-10-31 13:33:00 -07:00
|
|
|
^ s'tel/|
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
|
|
|
|
-- cursor movement
|
|
|
|
feed '<space>'
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
!kcor{2: s'tel}|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1: ~}|*3
|
2023-10-31 13:33:00 -07:00
|
|
|
^ s'tel/|
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
|
|
|
|
feed 'rock'
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
!{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/|
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
|
|
|
|
feed '<right>'
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
!{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/|
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
|
|
|
|
feed '<left>'
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
!{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/|
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
|
|
|
|
feed '<cr>'
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
!{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/ |
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
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()
|
2024-11-11 14:15:19 -07:00
|
|
|
screen = Screen.new(25, 5)
|
2022-07-25 19:21:30 -07:00
|
|
|
command('set laststatus=2')
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('from normal mode', function()
|
|
|
|
command('set statusline=%{mode()}')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-07-25 19:21:30 -07:00
|
|
|
{3:n }|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
|
|
|
|
feed(':')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-07-25 19:21:30 -07:00
|
|
|
{3:c }|
|
|
|
|
:^ |
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('from normal mode when : is mapped', function()
|
|
|
|
command('set statusline=%{mode()}')
|
|
|
|
command('nnoremap ; :')
|
|
|
|
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-07-25 19:21:30 -07:00
|
|
|
{3:n }|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
|
|
|
|
feed(';')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-07-25 19:21:30 -07:00
|
|
|
{3:c }|
|
|
|
|
:^ |
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
end)
|
|
|
|
|
2022-09-27 07:19:15 -07:00
|
|
|
it('with scrolled messages', function()
|
2022-09-26 06:23:43 -07:00
|
|
|
screen:try_resize(35, 14)
|
|
|
|
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>')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2024-11-09 06:14:29 -07:00
|
|
|
{5: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: }|
|
2024-11-09 06:14:29 -07:00
|
|
|
{9:E121: Undefined variable: doesnotex}|
|
|
|
|
{9:ist} |
|
|
|
|
{6:Press ENTER or type command to cont}|
|
|
|
|
{6:inue}^ |
|
2022-07-25 19:21:30 -07:00
|
|
|
]],
|
|
|
|
}
|
|
|
|
feed(':echoerr doesnotexist<cr>')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2024-11-09 06:14:29 -07:00
|
|
|
{5:c2 }|
|
2022-09-26 06:23:43 -07:00
|
|
|
|
|
|
|
|
{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: }|
|
2024-11-09 06:14:29 -07:00
|
|
|
{9:E121: Undefined variable: doesnotex}|
|
|
|
|
{9:ist} |
|
|
|
|
{6:Press ENTER or type command to cont}|
|
|
|
|
{9:E121: Undefined variable: doesnotex}|
|
|
|
|
{9:ist} |
|
|
|
|
{6:Press ENTER or type command to cont}|
|
|
|
|
{6:inue}^ |
|
2022-09-26 06:23:43 -07:00
|
|
|
]],
|
|
|
|
}
|
|
|
|
|
|
|
|
feed(':echoerr doesnotexist<cr>')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2024-11-09 06:14:29 -07:00
|
|
|
{5:c3 }|
|
2022-09-26 06:23:43 -07:00
|
|
|
|
|
|
|
|
{3:c3 }|
|
2022-07-25 19:21:30 -07:00
|
|
|
{3: }|
|
2024-11-09 06:14:29 -07:00
|
|
|
{9:E121: Undefined variable: doesnotex}|
|
|
|
|
{9:ist} |
|
|
|
|
{6:Press ENTER or type command to cont}|
|
|
|
|
{9:E121: Undefined variable: doesnotex}|
|
|
|
|
{9:ist} |
|
|
|
|
{6:Press ENTER or type command to cont}|
|
|
|
|
{9:E121: Undefined variable: doesnotex}|
|
|
|
|
{9:ist} |
|
|
|
|
{6:Press ENTER or type command to cont}|
|
|
|
|
{6:inue}^ |
|
2022-09-26 06:23:43 -07:00
|
|
|
]],
|
|
|
|
}
|
|
|
|
|
|
|
|
feed('<cr>')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2024-11-09 06:14:29 -07:00
|
|
|
{5:n3 }|
|
2022-09-26 06:23:43 -07:00
|
|
|
^ |
|
|
|
|
{3:n3 }|
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*8
|
2022-09-26 06:23:43 -07:00
|
|
|
{2:[No Name] }|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
end)
|
|
|
|
|
2022-07-25 19:21:30 -07:00
|
|
|
describe('if custom statusline is set by', function()
|
|
|
|
before_each(function()
|
|
|
|
command('set statusline=')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-07-25 19:21:30 -07:00
|
|
|
{3:[No Name] }|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('CmdlineEnter autocommand', function()
|
|
|
|
command('autocmd CmdlineEnter * set statusline=command')
|
|
|
|
feed(':')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-07-25 19:21:30 -07:00
|
|
|
{3:command }|
|
|
|
|
:^ |
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('ModeChanged autocommand', function()
|
|
|
|
command('autocmd ModeChanged *:c set statusline=command')
|
|
|
|
feed(':')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-07-25 19:21:30 -07:00
|
|
|
{3:command }|
|
|
|
|
:^ |
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
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)
|
|
|
|
|
|
|
|
exec([[
|
|
|
|
set showtabline=2
|
|
|
|
set tabline=%!MyTabLine()
|
|
|
|
|
|
|
|
function! MyTabLine()
|
|
|
|
|
|
|
|
return "foo"
|
|
|
|
endfunction
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('gQ')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
{2:foo }|
|
|
|
|
|
|
2024-11-09 06:14:29 -07:00
|
|
|
{3: }|
|
2023-06-22 15:40:26 -07:00
|
|
|
Entering Ex mode. Type "visual" to go to Normal mode. |
|
|
|
|
:^ |
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
|
|
|
|
feed('echo 1<CR>')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2024-11-09 06:14:29 -07:00
|
|
|
{3: }|
|
2023-06-22 15:40:26 -07:00
|
|
|
Entering Ex mode. Type "visual" to go to Normal mode. |
|
|
|
|
:echo 1 |
|
|
|
|
1 |
|
|
|
|
:^ |
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
end)
|
|
|
|
|
2021-04-01 04:46:12 -07:00
|
|
|
describe('cmdline height', function()
|
2023-07-24 03:56:26 -07:00
|
|
|
before_each(clear)
|
|
|
|
|
2021-04-01 04:46:12 -07:00
|
|
|
it('does not crash resized screen #14263', function()
|
|
|
|
local screen = Screen.new(25, 10)
|
|
|
|
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)
|
|
|
|
end)
|
|
|
|
|
2023-09-24 11:15:33 -07:00
|
|
|
it('with redrawdebug=invalid resize -1', function()
|
|
|
|
command('set redrawdebug=invalid cmdheight=0 noruler laststatus=0')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2023-09-24 11:15:33 -07:00
|
|
|
]],
|
|
|
|
}
|
|
|
|
feed(':resize -1<CR>')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2023-09-24 11:15:33 -07:00
|
|
|
|
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
assert_alive()
|
|
|
|
end)
|
|
|
|
|
2022-06-13 02:40:51 -07:00
|
|
|
it('with cmdheight=1 noruler laststatus=2', function()
|
|
|
|
command('set cmdheight=1 noruler laststatus=2')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2024-03-26 13:23:36 -07:00
|
|
|
{3:[No Name] }|
|
2022-06-13 02:40:51 -07:00
|
|
|
|
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('with cmdheight=0 noruler laststatus=2', function()
|
|
|
|
command('set cmdheight=0 noruler laststatus=2')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2024-03-26 13:23:36 -07:00
|
|
|
{3:[No Name] }|
|
2022-06-13 02:40:51 -07:00
|
|
|
]],
|
|
|
|
}
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('with cmdheight=0 ruler laststatus=0', function()
|
|
|
|
command('set cmdheight=0 ruler laststatus=0')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2022-06-13 02:40:51 -07:00
|
|
|
]],
|
|
|
|
}
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('with cmdheight=0 ruler laststatus=0', function()
|
|
|
|
command('set cmdheight=0 noruler laststatus=0 showmode')
|
|
|
|
feed('i')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2022-06-13 02:40:51 -07:00
|
|
|
]],
|
|
|
|
showmode = {},
|
|
|
|
}
|
|
|
|
feed('<Esc>')
|
|
|
|
eq(0, eval('&cmdheight'))
|
|
|
|
end)
|
|
|
|
|
2022-06-30 18:59:50 -07:00
|
|
|
it('with cmdheight=0 ruler rulerformat laststatus=0', function()
|
|
|
|
command('set cmdheight=0 noruler laststatus=0 rulerformat=%l,%c%= showmode')
|
|
|
|
feed('i')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2022-06-30 18:59:50 -07:00
|
|
|
]],
|
|
|
|
showmode = {},
|
|
|
|
}
|
|
|
|
feed('<Esc>')
|
|
|
|
eq(0, eval('&cmdheight'))
|
|
|
|
end)
|
|
|
|
|
2022-06-13 02:40:51 -07:00
|
|
|
it('with showmode', function()
|
|
|
|
command('set cmdheight=1 noruler laststatus=0 showmode')
|
|
|
|
feed('i')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2024-03-26 13:23:36 -07:00
|
|
|
{5:-- INSERT --} |
|
2022-06-13 02:40:51 -07:00
|
|
|
]],
|
|
|
|
}
|
|
|
|
feed('<Esc>')
|
|
|
|
eq(1, eval('&cmdheight'))
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('when using command line', function()
|
|
|
|
command('set cmdheight=0 noruler laststatus=0')
|
|
|
|
feed(':')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2022-06-13 02:40:51 -07:00
|
|
|
:^ |
|
|
|
|
]],
|
|
|
|
}
|
2022-09-13 03:56:30 -07:00
|
|
|
eq(0, eval('&cmdheight'))
|
2022-06-13 02:40:51 -07:00
|
|
|
feed('<cr>')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2022-06-13 02:40:51 -07:00
|
|
|
]],
|
|
|
|
showmode = {},
|
|
|
|
}
|
|
|
|
eq(0, eval('&cmdheight'))
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('when using input()', function()
|
|
|
|
command('set cmdheight=0 noruler laststatus=0')
|
|
|
|
feed(':call input("foo >")<cr>')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
|
|
2022-09-16 10:21:32 -07:00
|
|
|
{1:~ }|
|
2024-03-26 13:23:36 -07:00
|
|
|
{3: }|
|
2022-09-13 03:56:30 -07:00
|
|
|
:call input("foo >") |
|
2022-06-13 02:40:51 -07:00
|
|
|
foo >^ |
|
|
|
|
]],
|
|
|
|
}
|
2022-09-13 03:56:30 -07:00
|
|
|
eq(0, eval('&cmdheight'))
|
2022-06-13 02:40:51 -07:00
|
|
|
feed('<cr>')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2022-06-13 02:40:51 -07:00
|
|
|
]],
|
|
|
|
showmode = {},
|
|
|
|
}
|
|
|
|
eq(0, eval('&cmdheight'))
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('with winbar and splits', function()
|
|
|
|
command('set cmdheight=0 noruler laststatus=3 winbar=foo')
|
|
|
|
feed(':split<CR>')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2024-03-26 13:23:36 -07:00
|
|
|
{3: }|
|
2022-09-13 03:56:30 -07:00
|
|
|
:split |
|
2024-03-26 13:23:36 -07:00
|
|
|
{9:E36: Not enough room} |
|
|
|
|
{6:Press ENTER or type comma}|
|
|
|
|
{6:nd to continue}^ |
|
2022-06-13 02:40:51 -07:00
|
|
|
]],
|
|
|
|
}
|
|
|
|
feed('<CR>')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2024-03-26 13:23:36 -07:00
|
|
|
{5:foo }|
|
2022-06-13 02:40:51 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2024-03-26 13:23:36 -07:00
|
|
|
{3:[No Name] }|
|
2022-06-13 02:40:51 -07:00
|
|
|
]],
|
|
|
|
}
|
|
|
|
feed(':')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2024-03-26 13:23:36 -07:00
|
|
|
{5: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
|
|
|
:^ |
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
feed('<Esc>')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2024-03-26 13:23:36 -07:00
|
|
|
{5:foo }|
|
2022-06-13 02:40:51 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2024-03-26 13:23:36 -07:00
|
|
|
{3:[No Name] }|
|
2022-06-13 02:40:51 -07:00
|
|
|
]],
|
|
|
|
showmode = {},
|
|
|
|
}
|
|
|
|
eq(0, eval('&cmdheight'))
|
|
|
|
|
|
|
|
assert_alive()
|
|
|
|
end)
|
2022-06-30 18:59:50 -07:00
|
|
|
|
|
|
|
it('when macro with lastline', function()
|
|
|
|
command('set cmdheight=0 display=lastline')
|
|
|
|
feed('qq')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2022-09-13 03:56:30 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-06-30 18:59:50 -07:00
|
|
|
feed('q')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2022-09-13 03:56:30 -07:00
|
|
|
]],
|
|
|
|
unchanged = true,
|
|
|
|
}
|
2022-06-30 18:59:50 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('when substitute text', function()
|
|
|
|
command('set cmdheight=0 noruler laststatus=3')
|
|
|
|
feed('ifoo<ESC>')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
fo^o |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2024-03-26 13:23:36 -07:00
|
|
|
{3:[No Name] [+] }|
|
2022-06-30 18:59:50 -07:00
|
|
|
]],
|
|
|
|
}
|
|
|
|
|
|
|
|
feed(':%s/foo/bar/gc<CR>')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2024-03-26 13:23:36 -07:00
|
|
|
{2:foo} |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2024-03-26 13:23:36 -07:00
|
|
|
{6:replace wi...q/l/^E/^Y)?}^ |
|
2022-06-30 18:59:50 -07:00
|
|
|
]],
|
|
|
|
}
|
|
|
|
|
|
|
|
feed('y')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^bar |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2024-03-26 13:23:36 -07:00
|
|
|
{3:[No Name] [+] }|
|
2022-06-30 18:59:50 -07:00
|
|
|
]],
|
|
|
|
}
|
|
|
|
|
|
|
|
assert_alive()
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('when window resize', function()
|
|
|
|
command('set cmdheight=0')
|
|
|
|
feed('<C-w>+')
|
|
|
|
eq(0, eval('&cmdheight'))
|
|
|
|
end)
|
2022-09-16 10:21:32 -07:00
|
|
|
|
|
|
|
it('with non-silent mappings with cmdline', function()
|
|
|
|
command('set cmdheight=0')
|
|
|
|
command('map <f3> :nohlsearch<cr>')
|
|
|
|
feed('iaabbaa<esc>/aa<cr>')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2024-03-26 13:23:36 -07:00
|
|
|
{10:^aa}bb{10:aa} |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2022-09-16 10:21:32 -07:00
|
|
|
]],
|
|
|
|
}
|
|
|
|
|
|
|
|
feed('<f3>')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^aabbaa |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2022-09-16 10:21:32 -07:00
|
|
|
]],
|
|
|
|
}
|
|
|
|
end)
|
2022-09-26 01:40:34 -07:00
|
|
|
|
|
|
|
it('with silent! at startup', function()
|
|
|
|
clear { args = { '-c', 'set cmdheight=0', '-c', 'autocmd VimEnter * silent! call Foo()' } }
|
2024-11-11 14:15:19 -07:00
|
|
|
screen = Screen.new(25, 5)
|
2022-09-26 01:40:34 -07:00
|
|
|
-- doesn't crash while not displaying silent! error message
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2022-09-26 01:40:34 -07:00
|
|
|
]],
|
|
|
|
}
|
|
|
|
end)
|
2022-09-26 02:40:06 -07:00
|
|
|
|
|
|
|
it('with multigrid', function()
|
|
|
|
clear { args = { '--cmd', 'set cmdheight=0' } }
|
2024-11-11 14:15:19 -07:00
|
|
|
screen = Screen.new(25, 5, { ext_multigrid = true })
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_buf_set_lines(0, 0, -1, true, { 'p' })
|
2022-09-26 02:40:06 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
## 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
|
|
|
|
]],
|
|
|
|
win_viewport = {
|
2023-03-12 15:58:46 -07:00
|
|
|
[2] = {
|
2024-01-16 06:26:21 -07:00
|
|
|
win = 1000,
|
2023-03-12 15:58:46 -07:00
|
|
|
topline = 0,
|
|
|
|
botline = 2,
|
|
|
|
curline = 0,
|
|
|
|
curcol = 0,
|
|
|
|
linecount = 1,
|
|
|
|
sum_scroll_delta = 0,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
|
|
|
},
|
2022-09-26 02:40:06 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
feed '/p'
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
## grid 1
|
2023-12-09 05:42:00 -07:00
|
|
|
[2:-------------------------]|*4
|
2022-09-26 02:40:06 -07:00
|
|
|
[3:-------------------------]|
|
|
|
|
## grid 2
|
2024-03-26 13:23:36 -07:00
|
|
|
{2:p} |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*4
|
2022-09-26 02:40:06 -07:00
|
|
|
## grid 3
|
|
|
|
/p^ |
|
|
|
|
]],
|
|
|
|
win_viewport = {
|
2023-03-12 15:58:46 -07:00
|
|
|
[2] = {
|
2024-01-16 06:26:21 -07:00
|
|
|
win = 1000,
|
2023-03-12 15:58:46 -07:00
|
|
|
topline = 0,
|
|
|
|
botline = 2,
|
|
|
|
curline = 0,
|
2024-04-02 04:08:03 -07:00
|
|
|
curcol = 1,
|
2023-03-12 15:58:46 -07:00
|
|
|
linecount = 1,
|
|
|
|
sum_scroll_delta = 0,
|
2024-01-02 18:09:18 -07:00
|
|
|
},
|
|
|
|
},
|
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([[
|
2024-03-26 13:23:36 -07:00
|
|
|
{5:c :}|
|
2022-09-26 06:23:43 -07:00
|
|
|
|
|
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([[
|
2024-03-26 13:23:36 -07:00
|
|
|
{5:c :}|
|
2022-09-26 06:23:43 -07:00
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2022-09-26 06:23:43 -07:00
|
|
|
:echo^ |
|
|
|
|
]])
|
|
|
|
command('redrawstatus')
|
|
|
|
screen:expect([[
|
2024-03-26 13:23:36 -07:00
|
|
|
{5:c :echo}|
|
2022-09-26 06:23:43 -07:00
|
|
|
|
|
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
|
2024-03-26 13:23:36 -07:00
|
|
|
{3:[No Name] }│{1:~ }|
|
2022-09-27 15:22:11 -07:00
|
|
|
│{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:~ }|
|
2024-03-26 13:23:36 -07:00
|
|
|
{3:[No Name] }│{1:~ }|
|
2022-09-27 15:22:11 -07:00
|
|
|
│{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
|
2024-03-26 13:23:36 -07:00
|
|
|
{3:[No Name] }│{1:~ }|
|
2022-09-27 15:22:11 -07:00
|
|
|
│{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
|
2024-03-26 13:23:36 -07:00
|
|
|
{3:[No Name] }|
|
2022-12-30 17:30:05 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
command('set cmdheight=0')
|
2023-09-20 12:51:57 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*3
|
2024-03-26 13:23:36 -07:00
|
|
|
{3:[No Name] }|
|
2023-09-20 12:51:57 -07:00
|
|
|
]],
|
|
|
|
}
|
2022-12-30 17:30:05 -07:00
|
|
|
command('resize -1')
|
2023-09-20 12:51:57 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2024-03-26 13:23:36 -07:00
|
|
|
{3:[No Name] }|
|
2023-09-20 12:51:57 -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
|
2024-03-26 13:23:36 -07:00
|
|
|
{3:[No Name] }|
|
2022-12-30 17:30:05 -07:00
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
2024-03-15 04:54:39 -07:00
|
|
|
it('can be resized with external messages', function()
|
2022-12-30 17:30:05 -07:00
|
|
|
clear()
|
2024-11-11 14:15:19 -07:00
|
|
|
screen = Screen.new(25, 5, { 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([[
|
|
|
|
^ |
|
2024-03-15 04:54:39 -07:00
|
|
|
{1:~ }|*2
|
2022-12-30 17:30:05 -07:00
|
|
|
{3:[No Name] }|
|
2024-03-15 04:54:39 -07:00
|
|
|
|
|
2022-12-30 17:30:05 -07:00
|
|
|
]])
|
2024-03-15 04:54:39 -07:00
|
|
|
api.nvim_input_mouse('left', 'press', '', 0, 3, 10)
|
2023-01-12 21:25:19 -07:00
|
|
|
poke_eventloop()
|
2024-03-15 04:54:39 -07:00
|
|
|
api.nvim_input_mouse('left', 'drag', '', 0, 4, 10)
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
|
|
|
{1:~ }|*3
|
|
|
|
{3:[No Name] }|
|
|
|
|
]])
|
2022-12-30 17:30:05 -07:00
|
|
|
end)
|
2022-06-13 02:40:51 -07:00
|
|
|
end)
|