aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/cmdline_spec.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2024-01-03 02:09:18 +0100
committerJustin M. Keyes <justinkz@gmail.com>2024-01-03 02:09:29 +0100
commit04f2f864e270e772c6326cefdf24947f0130e492 (patch)
tree46f83f909b888a66c741032ab955afc6eab84292 /test/functional/ui/cmdline_spec.lua
parent59d117ec99b6037cb9fad5bbfb6d0b18f5012927 (diff)
downloadrneovim-04f2f864e270e772c6326cefdf24947f0130e492.tar.gz
rneovim-04f2f864e270e772c6326cefdf24947f0130e492.tar.bz2
rneovim-04f2f864e270e772c6326cefdf24947f0130e492.zip
refactor: format test/*
Diffstat (limited to 'test/functional/ui/cmdline_spec.lua')
-rw-r--r--test/functional/ui/cmdline_spec.lua1257
1 files changed, 802 insertions, 455 deletions
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua
index cac070406d..82ff633fcb 100644
--- a/test/functional/ui/cmdline_spec.lua
+++ b/test/functional/ui/cmdline_spec.lua
@@ -15,16 +15,16 @@ local function new_screen(opt)
local screen = Screen.new(25, 5)
screen:attach(opt)
screen:set_default_attr_ids({
- [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};
+ [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 },
})
return screen
end
@@ -34,326 +34,445 @@ local function test_cmdline(linegrid)
before_each(function()
clear()
- screen = new_screen({rgb=true, ext_cmdline=true, ext_linegrid=linegrid})
+ screen = new_screen({ rgb = true, ext_cmdline = true, ext_linegrid = linegrid })
end)
it('works', function()
feed(':')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- firstc = ":",
- content = {{""}},
- pos = 0,
- }}}
+ ]],
+ cmdline = { {
+ firstc = ':',
+ content = { { '' } },
+ pos = 0,
+ } },
+ }
feed('sign')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- firstc = ":",
- content = {{"sign"}},
- pos = 4,
- }}}
+ ]],
+ cmdline = {
+ {
+ firstc = ':',
+ content = { { 'sign' } },
+ pos = 4,
+ },
+ },
+ }
feed('<Left>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- firstc = ":",
- content = {{"sign"}},
- pos = 3,
- }}}
+ ]],
+ cmdline = {
+ {
+ firstc = ':',
+ content = { { 'sign' } },
+ pos = 3,
+ },
+ },
+ }
feed('<bs>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- firstc = ":",
- content = {{"sin"}},
- pos = 2,
- }}}
+ ]],
+ cmdline = {
+ {
+ firstc = ':',
+ content = { { 'sin' } },
+ pos = 2,
+ },
+ },
+ }
feed('<Esc>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]]}
+ ]],
+ }
end)
- it("works with input()", function()
+ it('works with input()', function()
feed(':call input("input", "default")<cr>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- prompt = "input",
- content = {{"default"}},
- pos = 7,
- }}}
+ ]],
+ cmdline = {
+ {
+ prompt = 'input',
+ content = { { 'default' } },
+ pos = 7,
+ },
+ },
+ }
feed('<cr>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]]}
+ ]],
+ }
end)
- it("works with special chars and nested cmdline", function()
+ it('works with special chars and nested cmdline', function()
feed(':xx<c-r>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- firstc = ":",
- content = {{"xx"}},
- pos = 2,
- special = {'"', true},
- }}}
+ ]],
+ cmdline = {
+ {
+ firstc = ':',
+ content = { { 'xx' } },
+ pos = 2,
+ special = { '"', true },
+ },
+ },
+ }
feed('=')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- firstc = ":",
- content = {{"xx"}},
- pos = 2,
- special = {'"', true},
- }, {
- firstc = "=",
- content = {{""}},
- pos = 0,
- }}}
+ ]],
+ cmdline = {
+ {
+ firstc = ':',
+ content = { { 'xx' } },
+ pos = 2,
+ special = { '"', true },
+ },
+ {
+ firstc = '=',
+ content = { { '' } },
+ pos = 0,
+ },
+ },
+ }
feed('1+2')
- local expectation = {{
- firstc = ":",
- content = {{"xx"}},
- pos = 2,
- special = {'"', true},
- }, {
- firstc = "=",
- content = {{"1", 6}, {"+", 7}, {"2", 6}},
- pos = 3,
- }}
-
- screen:expect{grid=[[
+ local expectation = {
+ {
+ firstc = ':',
+ content = { { 'xx' } },
+ pos = 2,
+ special = { '"', true },
+ },
+ {
+ firstc = '=',
+ content = { { '1', 6 }, { '+', 7 }, { '2', 6 } },
+ pos = 3,
+ },
+ }
+
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline=expectation}
+ ]],
+ cmdline = expectation,
+ }
-- erase information, so we check if it is retransmitted
- command("mode")
- screen:expect{grid=[[
+ command('mode')
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline=expectation, reset=true}
-
+ ]],
+ cmdline = expectation,
+ reset = true,
+ }
feed('<cr>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- firstc = ":",
- content = {{"xx3"}},
- pos = 3,
- }}}
+ ]],
+ cmdline = {
+ {
+ firstc = ':',
+ content = { { 'xx3' } },
+ pos = 3,
+ },
+ },
+ }
feed('<esc>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]]}
+ ]],
+ }
end)
- it("works with function definitions", function()
+ it('works with function definitions', function()
feed(':function Foo()<cr>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- indent = 2,
- firstc = ":",
- content = {{""}},
- pos = 0,
- }}, cmdline_block = {
- {{'function Foo()'}},
- }}
+ ]],
+ cmdline = {
+ {
+ indent = 2,
+ firstc = ':',
+ content = { { '' } },
+ pos = 0,
+ },
+ },
+ cmdline_block = {
+ { { 'function Foo()' } },
+ },
+ }
feed('line1<cr>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- indent = 2,
- firstc = ":",
- content = {{""}},
- pos = 0,
- }}, cmdline_block = {
- {{'function Foo()'}},
- {{' line1'}},
- }}
-
- command("mode")
- screen:expect{grid=[[
+ ]],
+ cmdline = {
+ {
+ indent = 2,
+ firstc = ':',
+ content = { { '' } },
+ pos = 0,
+ },
+ },
+ cmdline_block = {
+ { { 'function Foo()' } },
+ { { ' line1' } },
+ },
+ }
+
+ command('mode')
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- indent = 2,
- firstc = ":",
- content = {{""}},
- pos = 0,
- }}, cmdline_block = {
- {{'function Foo()'}},
- {{' line1'}},
- }, reset=true}
+ ]],
+ cmdline = {
+ {
+ indent = 2,
+ firstc = ':',
+ content = { { '' } },
+ pos = 0,
+ },
+ },
+ cmdline_block = {
+ { { 'function Foo()' } },
+ { { ' line1' } },
+ },
+ reset = true,
+ }
feed('endfunction<cr>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]]}
+ ]],
+ }
-- Try once more, to check buffer is reinitialized. #8007
feed(':function Bar()<cr>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- indent = 2,
- firstc = ":",
- content = {{""}},
- pos = 0,
- }}, cmdline_block = {
- {{'function Bar()'}},
- }}
+ ]],
+ cmdline = {
+ {
+ indent = 2,
+ firstc = ':',
+ content = { { '' } },
+ pos = 0,
+ },
+ },
+ cmdline_block = {
+ { { 'function Bar()' } },
+ },
+ }
feed('endfunction<cr>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]]}
-
+ ]],
+ }
end)
- it("works with cmdline window", function()
+ it('works with cmdline window', function()
feed(':make')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- firstc = ":",
- content = {{"make"}},
- pos = 4,
- }}}
+ ]],
+ cmdline = {
+ {
+ firstc = ':',
+ content = { { 'make' } },
+ pos = 4,
+ },
+ },
+ }
feed('<c-f>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
{2:[No Name] }|
{1::}mak^e |
{3:[Command Line] }|
|
- ]]}
+ ]],
+ }
-- nested cmdline
feed(':yank')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
{2:[No Name] }|
{1::}mak^e |
{3:[Command Line] }|
|
- ]], cmdline={nil, {
- firstc = ":",
- content = {{"yank"}},
- pos = 4,
- }}}
-
- command("mode")
- screen:expect{grid=[[
+ ]],
+ cmdline = {
+ nil,
+ {
+ firstc = ':',
+ content = { { 'yank' } },
+ pos = 4,
+ },
+ },
+ }
+
+ command('mode')
+ screen:expect {
+ grid = [[
|
{2:[No Name] }|
{1::}mak^e |
{3:[Command Line] }|
|
- ]], cmdline={nil, {
- firstc = ":",
- content = {{"yank"}},
- pos = 4,
- }}, reset=true}
-
- feed("<c-c>")
- screen:expect{grid=[[
+ ]],
+ cmdline = {
+ nil,
+ {
+ firstc = ':',
+ content = { { 'yank' } },
+ pos = 4,
+ },
+ },
+ reset = true,
+ }
+
+ feed('<c-c>')
+ screen:expect {
+ grid = [[
|
{2:[No Name] }|
{1::}mak^e |
{3:[Command Line] }|
|
- ]]}
+ ]],
+ }
- feed("<c-c>")
- screen:expect{grid=[[
+ feed('<c-c>')
+ screen:expect {
+ grid = [[
^ |
{2:[No Name] }|
{1::}make |
{3:[Command Line] }|
|
- ]], cmdline={{
- firstc = ":",
- content = {{"make"}},
- pos = 4,
- }}}
-
- command("redraw!")
- screen:expect{grid=[[
+ ]],
+ cmdline = {
+ {
+ firstc = ':',
+ content = { { 'make' } },
+ pos = 4,
+ },
+ },
+ }
+
+ command('redraw!')
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- firstc = ":",
- content = {{"make"}},
- pos = 4,
- }}}
+ ]],
+ cmdline = {
+ {
+ firstc = ':',
+ content = { { 'make' } },
+ pos = 4,
+ },
+ },
+ }
end)
it('works with inputsecret()', function()
feed(":call inputsecret('secret:')<cr>abc123")
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- prompt = "secret:",
- content = {{"******"}},
- pos = 6,
- }}}
+ ]],
+ cmdline = {
+ {
+ prompt = 'secret:',
+ content = { { '******' } },
+ pos = 6,
+ },
+ },
+ }
end)
it('works with highlighted cmdline', function()
@@ -383,21 +502,33 @@ local function test_cmdline(linegrid)
"map <f5> :let x = input({'prompt':'>'})<cr>
]])
screen:set_default_attr_ids({
- RBP1={background = Screen.colors.Red},
- RBP2={background = Screen.colors.Yellow},
- EOB={bold = true, foreground = Screen.colors.Blue1},
+ RBP1 = { background = Screen.colors.Red },
+ RBP2 = { background = Screen.colors.Yellow },
+ EOB = { bold = true, foreground = Screen.colors.Blue1 },
})
feed('<f5>(a(b)a)')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{EOB:~ }|*3
|
- ]], cmdline={{
- prompt = '>',
- content = {{'(', 'RBP1'}, {'a'}, {'(', 'RBP2'}, {'b'},
- { ')', 'RBP2'}, {'a'}, {')', 'RBP1'}},
- pos = 7,
- }}}
+ ]],
+ cmdline = {
+ {
+ prompt = '>',
+ content = {
+ { '(', 'RBP1' },
+ { 'a' },
+ { '(', 'RBP2' },
+ { 'b' },
+ { ')', 'RBP2' },
+ { 'a' },
+ { ')', 'RBP1' },
+ },
+ pos = 7,
+ },
+ },
+ }
end)
it('works together with ext_wildmenu', function()
@@ -415,69 +546,102 @@ local function test_cmdline(linegrid)
screen:set_option('ext_wildmenu', true)
feed(':sign <tab>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- firstc = ":",
- content = {{"sign define"}},
- pos = 11,
- }}, wildmenu_items=expected, wildmenu_pos=0}
+ ]],
+ cmdline = {
+ {
+ firstc = ':',
+ content = { { 'sign define' } },
+ pos = 11,
+ },
+ },
+ wildmenu_items = expected,
+ wildmenu_pos = 0,
+ }
feed('<tab>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- firstc = ":",
- content = {{"sign jump"}},
- pos = 9,
- }}, wildmenu_items=expected, wildmenu_pos=1}
+ ]],
+ cmdline = {
+ {
+ firstc = ':',
+ content = { { 'sign jump' } },
+ pos = 9,
+ },
+ },
+ wildmenu_items = expected,
+ wildmenu_pos = 1,
+ }
feed('<left><left>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- firstc = ":",
- content = {{"sign "}},
- pos = 5,
- }}, wildmenu_items=expected, wildmenu_pos=-1}
+ ]],
+ cmdline = {
+ {
+ firstc = ':',
+ content = { { 'sign ' } },
+ pos = 5,
+ },
+ },
+ wildmenu_items = expected,
+ wildmenu_pos = -1,
+ }
feed('<right>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- firstc = ":",
- content = {{"sign define"}},
- pos = 11,
- }}, wildmenu_items=expected, wildmenu_pos=0}
+ ]],
+ cmdline = {
+ {
+ firstc = ':',
+ content = { { 'sign define' } },
+ pos = 11,
+ },
+ },
+ wildmenu_items = expected,
+ wildmenu_pos = 0,
+ }
feed('a')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- firstc = ":",
- content = {{"sign definea"}},
- pos = 12,
- }}}
+ ]],
+ cmdline = {
+ {
+ firstc = ':',
+ content = { { 'sign definea' } },
+ pos = 12,
+ },
+ },
+ }
end)
it('works together with ext_popupmenu', function()
local expected = {
- {'define', '', '', ''},
- {'jump', '', '', ''},
- {'list', '', '', ''},
- {'place', '', '', ''},
- {'undefine', '', '', ''},
- {'unplace', '', '', ''},
+ { 'define', '', '', '' },
+ { 'jump', '', '', '' },
+ { 'list', '', '', '' },
+ { 'place', '', '', '' },
+ { 'undefine', '', '', '' },
+ { 'unplace', '', '', '' },
}
command('set wildmode=full')
@@ -485,80 +649,115 @@ local function test_cmdline(linegrid)
screen:set_option('ext_popupmenu', true)
feed(':sign <tab>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- firstc = ":",
- content = {{"sign define"}},
- pos = 11,
- }}, popupmenu={items=expected, pos=0, anchor={-1, 0, 5}}}
+ ]],
+ cmdline = {
+ {
+ firstc = ':',
+ content = { { 'sign define' } },
+ pos = 11,
+ },
+ },
+ popupmenu = { items = expected, pos = 0, anchor = { -1, 0, 5 } },
+ }
feed('<tab>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- firstc = ":",
- content = {{"sign jump"}},
- pos = 9,
- }}, popupmenu={items=expected, pos=1, anchor={-1, 0, 5}}}
+ ]],
+ cmdline = {
+ {
+ firstc = ':',
+ content = { { 'sign jump' } },
+ pos = 9,
+ },
+ },
+ popupmenu = { items = expected, pos = 1, anchor = { -1, 0, 5 } },
+ }
feed('<left><left>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- firstc = ":",
- content = {{"sign "}},
- pos = 5,
- }}, popupmenu={items=expected, pos=-1, anchor={-1, 0, 5}}}
+ ]],
+ cmdline = {
+ {
+ firstc = ':',
+ content = { { 'sign ' } },
+ pos = 5,
+ },
+ },
+ popupmenu = { items = expected, pos = -1, anchor = { -1, 0, 5 } },
+ }
feed('<right>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- firstc = ":",
- content = {{"sign define"}},
- pos = 11,
- }}, popupmenu={items=expected, pos=0, anchor={-1, 0, 5}}}
+ ]],
+ cmdline = {
+ {
+ firstc = ':',
+ content = { { 'sign define' } },
+ pos = 11,
+ },
+ },
+ popupmenu = { items = expected, pos = 0, anchor = { -1, 0, 5 } },
+ }
feed('a')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- firstc = ":",
- content = {{"sign definea"}},
- pos = 12,
- }}}
+ ]],
+ cmdline = {
+ {
+ firstc = ':',
+ content = { { 'sign definea' } },
+ pos = 12,
+ },
+ },
+ }
feed('<esc>')
-- check positioning with multibyte char in pattern
- command("e långfile1")
- command("sp långfile2")
+ command('e långfile1')
+ command('sp långfile2')
feed(':b lå<tab>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{3:långfile2 }|
|
{2:långfile1 }|
|
- ]], popupmenu={
- anchor = { -1, 0, 2 },
- items = {{ "långfile1", "", "", "" }, { "långfile2", "", "", "" }},
- pos = 0
- }, cmdline={{
- content = {{ "b långfile1" }},
- firstc = ":",
- pos = 12
- }}}
+ ]],
+ popupmenu = {
+ anchor = { -1, 0, 2 },
+ items = { { 'långfile1', '', '', '' }, { 'långfile2', '', '', '' } },
+ pos = 0,
+ },
+ cmdline = {
+ {
+ content = { { 'b långfile1' } },
+ firstc = ':',
+ pos = 12,
+ },
+ },
+ }
end)
it('ext_wildmenu takes precedence over ext_popupmenu', function()
@@ -577,15 +776,22 @@ local function test_cmdline(linegrid)
screen:set_option('ext_popupmenu', true)
feed(':sign <tab>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- firstc = ":",
- content = {{"sign define"}},
- pos = 11,
- }}, wildmenu_items=expected, wildmenu_pos=0}
+ ]],
+ cmdline = {
+ {
+ firstc = ':',
+ content = { { 'sign define' } },
+ pos = 11,
+ },
+ },
+ wildmenu_items = expected,
+ wildmenu_pos = 0,
+ }
end)
it("doesn't send invalid events when aborting mapping #10000", function()
@@ -593,16 +799,21 @@ local function test_cmdline(linegrid)
command('cnoremap ab c')
feed(':xa')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
{1:~ }|*3
|
- ]], cmdline={{
- content = { { "x" } },
- firstc = ":",
- pos = 1,
- special = { "a", false }
- }}}
+ ]],
+ cmdline = {
+ {
+ content = { { 'x' } },
+ firstc = ':',
+ pos = 1,
+ special = { 'a', false },
+ },
+ },
+ }
-- This used to send an invalid event where pos where larger than the total
-- length of content. Checked in _handle_cmdline_show.
@@ -613,61 +824,75 @@ local function test_cmdline(linegrid)
|
]])
end)
-
end
-- 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)
+describe('ui/ext_cmdline', function()
+ test_cmdline(true)
+end)
+describe('ui/ext_cmdline (legacy highlights)', function()
+ test_cmdline(false)
+end)
describe('cmdline redraw', function()
local screen
before_each(function()
clear()
- screen = new_screen({rgb=true})
+ screen = new_screen({ rgb = true })
end)
it('with timer', function()
feed(':012345678901234567890123456789')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
{1:~ }|
{3: }|
:012345678901234567890123|
456789^ |
- ]]}
+ ]],
+ }
command('call timer_start(0, {-> 1})')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
{1:~ }|
{3: }|
:012345678901234567890123|
456789^ |
- ]], unchanged=true, timeout=100}
+ ]],
+ unchanged = true,
+ timeout = 100,
+ }
end)
it('with <Cmd>', function()
if is_os('bsd') then
pending('FIXME #10804')
end
- command('cmap a <Cmd>call sin(0)<CR>') -- no-op
+ command('cmap a <Cmd>call sin(0)<CR>') -- no-op
feed(':012345678901234567890123456789')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
{1:~ }|
{3: }|
:012345678901234567890123|
456789^ |
- ]]}
+ ]],
+ }
feed('a')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
{1:~ }|
{3: }|
:012345678901234567890123|
456789^ |
- ]], unchanged=true}
+ ]],
+ unchanged = true,
+ }
end)
it('after pressing Ctrl-C in cmdwin in Visual mode #18967', function()
@@ -697,64 +922,80 @@ describe('cmdline redraw', function()
it('with rightleftcmd', function()
command('set rightleft rightleftcmd=search shortmess+=s')
- meths.buf_set_lines(0, 0, -1, true, {"let's rock!"})
- screen:expect{grid=[[
+ meths.buf_set_lines(0, 0, -1, true, { "let's rock!" })
+ screen:expect {
+ grid = [[
!kcor s'te^l|
{1: ~}|*3
|
- ]]}
+ ]],
+ }
feed '/'
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
!kcor s'tel|
{1: ~}|*3
^ /|
- ]]}
+ ]],
+ }
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=[[
+ screen:expect {
+ grid = [[
!kcor {2:s'tel}|
{1: ~}|*3
^ s'tel/|
- ]]}
+ ]],
+ }
-- cursor movement
- feed "<space>"
- screen:expect{grid=[[
+ feed '<space>'
+ screen:expect {
+ grid = [[
!kcor{2: s'tel}|
{1: ~}|*3
^ s'tel/|
- ]]}
+ ]],
+ }
- feed "rock"
- screen:expect{grid=[[
+ feed 'rock'
+ screen:expect {
+ grid = [[
!{2:kcor s'tel}|
{1: ~}|*3
^ kcor s'tel/|
- ]]}
+ ]],
+ }
- feed "<right>"
- screen:expect{grid=[[
+ feed '<right>'
+ screen:expect {
+ grid = [[
!{2:kcor s'tel}|
{1: ~}|*3
^kcor s'tel/|
- ]]}
+ ]],
+ }
- feed "<left>"
- screen:expect{grid=[[
+ feed '<left>'
+ screen:expect {
+ grid = [[
!{2:kcor s'tel}|
{1: ~}|*3
^ kcor s'tel/|
- ]]}
+ ]],
+ }
- feed "<cr>"
- screen:expect{grid=[[
+ feed '<cr>'
+ screen:expect {
+ grid = [[
!{10:kcor s'te^l}|
{1: ~}|*3
kcor s'tel/ |
- ]]}
+ ]],
+ }
end)
end)