aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/popupmenu_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/popupmenu_spec.lua
parent59d117ec99b6037cb9fad5bbfb6d0b18f5012927 (diff)
downloadrneovim-04f2f864e270e772c6326cefdf24947f0130e492.tar.gz
rneovim-04f2f864e270e772c6326cefdf24947f0130e492.tar.bz2
rneovim-04f2f864e270e772c6326cefdf24947f0130e492.zip
refactor: format test/*
Diffstat (limited to 'test/functional/ui/popupmenu_spec.lua')
-rw-r--r--test/functional/ui/popupmenu_spec.lua1359
1 files changed, 811 insertions, 548 deletions
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua
index 8ad5283b94..67a5f2ef77 100644
--- a/test/functional/ui/popupmenu_spec.lua
+++ b/test/functional/ui/popupmenu_spec.lua
@@ -18,16 +18,16 @@ describe('ui/ext_popupmenu', function()
before_each(function()
clear()
screen = Screen.new(60, 8)
- screen:attach({rgb=true, ext_popupmenu=true})
+ screen:attach({ rgb = true, ext_popupmenu = true })
screen:set_default_attr_ids({
- [1] = {bold=true, foreground=Screen.colors.Blue},
- [2] = {bold = true},
- [3] = {reverse = true},
- [4] = {bold = true, reverse = true},
- [5] = {bold = true, foreground = Screen.colors.SeaGreen},
- [6] = {background = Screen.colors.WebGray},
- [7] = {background = Screen.colors.LightMagenta},
- [8] = {foreground = Screen.colors.Red},
+ [1] = { bold = true, foreground = Screen.colors.Blue },
+ [2] = { bold = true },
+ [3] = { reverse = true },
+ [4] = { bold = true, reverse = true },
+ [5] = { bold = true, foreground = Screen.colors.SeaGreen },
+ [6] = { background = Screen.colors.WebGray },
+ [7] = { background = Screen.colors.LightMagenta },
+ [8] = { foreground = Screen.colors.Red },
})
source([[
function! TestComplete() abort
@@ -38,96 +38,116 @@ describe('ui/ext_popupmenu', function()
end)
local expected = {
- {'fo', 'x', 'the foo', 'foo-y'},
- {'bar', '', '', ''},
- {'spam', '', '', ''},
+ { 'fo', 'x', 'the foo', 'foo-y' },
+ { 'bar', '', '', '' },
+ { 'spam', '', '', '' },
}
it('works', function()
feed('o<C-r>=TestComplete()<CR>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
foo^ |
{1:~ }|*5
{2:-- INSERT --} |
- ]], popupmenu={
- items=expected,
- pos=0,
- anchor={1,1,0},
- }}
+ ]],
+ popupmenu = {
+ items = expected,
+ pos = 0,
+ anchor = { 1, 1, 0 },
+ },
+ }
feed('<c-p>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
^ |
{1:~ }|*5
{2:-- INSERT --} |
- ]], popupmenu={
- items=expected,
- pos=-1,
- anchor={1,1,0},
- }}
+ ]],
+ popupmenu = {
+ items = expected,
+ pos = -1,
+ anchor = { 1, 1, 0 },
+ },
+ }
-- down moves the selection in the menu, but does not insert anything
feed('<down><down>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
^ |
{1:~ }|*5
{2:-- INSERT --} |
- ]], popupmenu={
- items=expected,
- pos=1,
- anchor={1,1,0},
- }}
+ ]],
+ popupmenu = {
+ items = expected,
+ pos = 1,
+ anchor = { 1, 1, 0 },
+ },
+ }
feed('<cr>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
bar^ |
{1:~ }|*5
{2:-- INSERT --} |
- ]]}
+ ]],
+ }
end)
it('can be controlled by API', function()
feed('o<C-r>=TestComplete()<CR>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
foo^ |
{1:~ }|*5
{2:-- INSERT --} |
- ]], popupmenu={
- items=expected,
- pos=0,
- anchor={1,1,0},
- }}
-
- meths.select_popupmenu_item(1,false,false,{})
- screen:expect{grid=[[
+ ]],
+ popupmenu = {
+ items = expected,
+ pos = 0,
+ anchor = { 1, 1, 0 },
+ },
+ }
+
+ meths.select_popupmenu_item(1, false, false, {})
+ screen:expect {
+ grid = [[
|
foo^ |
{1:~ }|*5
{2:-- INSERT --} |
- ]], popupmenu={
- items=expected,
- pos=1,
- anchor={1,1,0},
- }}
-
- meths.select_popupmenu_item(2,true,false,{})
- screen:expect{grid=[[
+ ]],
+ popupmenu = {
+ items = expected,
+ pos = 1,
+ anchor = { 1, 1, 0 },
+ },
+ }
+
+ meths.select_popupmenu_item(2, true, false, {})
+ screen:expect {
+ grid = [[
|
spam^ |
{1:~ }|*5
{2:-- INSERT --} |
- ]], popupmenu={
- items=expected,
- pos=2,
- anchor={1,1,0},
- }}
+ ]],
+ popupmenu = {
+ items = expected,
+ pos = 2,
+ anchor = { 1, 1, 0 },
+ },
+ }
- meths.select_popupmenu_item(0,true,true,{})
+ meths.select_popupmenu_item(0, true, true, {})
screen:expect([[
|
foo^ |
@@ -135,68 +155,82 @@ describe('ui/ext_popupmenu', function()
{2:-- INSERT --} |
]])
-
feed('<c-w><C-r>=TestComplete()<CR>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
foo^ |
{1:~ }|*5
{2:-- INSERT --} |
- ]], popupmenu={
- items=expected,
- pos=0,
- anchor={1,1,0},
- }}
-
- meths.select_popupmenu_item(-1,false,false,{})
- screen:expect{grid=[[
+ ]],
+ popupmenu = {
+ items = expected,
+ pos = 0,
+ anchor = { 1, 1, 0 },
+ },
+ }
+
+ meths.select_popupmenu_item(-1, false, false, {})
+ screen:expect {
+ grid = [[
|
foo^ |
{1:~ }|*5
{2:-- INSERT --} |
- ]], popupmenu={
- items=expected,
- pos=-1,
- anchor={1,1,0},
- }}
-
- meths.select_popupmenu_item(1,true,false,{})
- screen:expect{grid=[[
+ ]],
+ popupmenu = {
+ items = expected,
+ pos = -1,
+ anchor = { 1, 1, 0 },
+ },
+ }
+
+ meths.select_popupmenu_item(1, true, false, {})
+ screen:expect {
+ grid = [[
|
bar^ |
{1:~ }|*5
{2:-- INSERT --} |
- ]], popupmenu={
- items=expected,
- pos=1,
- anchor={1,1,0},
- }}
-
- meths.select_popupmenu_item(-1,true,false,{})
- screen:expect{grid=[[
+ ]],
+ popupmenu = {
+ items = expected,
+ pos = 1,
+ anchor = { 1, 1, 0 },
+ },
+ }
+
+ meths.select_popupmenu_item(-1, true, false, {})
+ screen:expect {
+ grid = [[
|
^ |
{1:~ }|*5
{2:-- INSERT --} |
- ]], popupmenu={
- items=expected,
- pos=-1,
- anchor={1,1,0},
- }}
-
- meths.select_popupmenu_item(0,true,false,{})
- screen:expect{grid=[[
+ ]],
+ popupmenu = {
+ items = expected,
+ pos = -1,
+ anchor = { 1, 1, 0 },
+ },
+ }
+
+ meths.select_popupmenu_item(0, true, false, {})
+ screen:expect {
+ grid = [[
|
foo^ |
{1:~ }|*5
{2:-- INSERT --} |
- ]], popupmenu={
- items=expected,
- pos=0,
- anchor={1,1,0},
- }}
+ ]],
+ popupmenu = {
+ items = expected,
+ pos = 0,
+ anchor = { 1, 1, 0 },
+ },
+ }
- meths.select_popupmenu_item(-1,true,true,{})
+ meths.select_popupmenu_item(-1, true, true, {})
screen:expect([[
|
^ |
@@ -207,108 +241,133 @@ describe('ui/ext_popupmenu', function()
command('set wildmenu')
command('set wildoptions=pum')
local expected_wildpum = {
- { "define", "", "", "" },
- { "jump", "", "", "" },
- { "list", "", "", "" },
- { "place", "", "", "" },
- { "undefine", "", "", "" },
- { "unplace", "", "", "" },
+ { 'define', '', '', '' },
+ { 'jump', '', '', '' },
+ { 'list', '', '', '' },
+ { 'place', '', '', '' },
+ { 'undefine', '', '', '' },
+ { 'unplace', '', '', '' },
}
feed('<Esc>:sign <Tab>')
- screen:expect({grid = [[
+ screen:expect({
+ grid = [[
|*2
{1:~ }|*5
:sign define^ |
- ]], popupmenu = {
- items = expected_wildpum,
- pos = 0,
- anchor = { 1, 7, 6 },
- }})
+ ]],
+ popupmenu = {
+ items = expected_wildpum,
+ pos = 0,
+ anchor = { 1, 7, 6 },
+ },
+ })
meths.select_popupmenu_item(-1, true, false, {})
- screen:expect({grid = [[
+ screen:expect({
+ grid = [[
|*2
{1:~ }|*5
:sign ^ |
- ]], popupmenu = {
- items = expected_wildpum,
- pos = -1,
- anchor = { 1, 7, 6 },
- }})
+ ]],
+ popupmenu = {
+ items = expected_wildpum,
+ pos = -1,
+ anchor = { 1, 7, 6 },
+ },
+ })
meths.select_popupmenu_item(5, true, false, {})
- screen:expect({grid = [[
+ screen:expect({
+ grid = [[
|*2
{1:~ }|*5
:sign unplace^ |
- ]], popupmenu = {
- items = expected_wildpum,
- pos = 5,
- anchor = { 1, 7, 6 },
- }})
+ ]],
+ popupmenu = {
+ items = expected_wildpum,
+ pos = 5,
+ anchor = { 1, 7, 6 },
+ },
+ })
meths.select_popupmenu_item(-1, true, true, {})
- screen:expect({grid = [[
+ screen:expect({
+ grid = [[
|*2
{1:~ }|*5
:sign ^ |
- ]]})
+ ]],
+ })
feed('<Tab>')
- screen:expect({grid = [[
+ screen:expect({
+ grid = [[
|*2
{1:~ }|*5
:sign define^ |
- ]], popupmenu = {
- items = expected_wildpum,
- pos = 0,
- anchor = { 1, 7, 6 },
- }})
+ ]],
+ popupmenu = {
+ items = expected_wildpum,
+ pos = 0,
+ anchor = { 1, 7, 6 },
+ },
+ })
meths.select_popupmenu_item(5, true, true, {})
- screen:expect({grid = [[
+ screen:expect({
+ grid = [[
|*2
{1:~ }|*5
:sign unplace^ |
- ]]})
+ ]],
+ })
local function test_pum_select_mappings()
screen:set_option('ext_popupmenu', true)
feed('<Esc>A<C-r>=TestComplete()<CR>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
foo^ |
{1:~ }|*5
{2:-- INSERT --} |
- ]], popupmenu={
- items=expected,
- pos=0,
- anchor={1,1,0},
- }}
+ ]],
+ popupmenu = {
+ items = expected,
+ pos = 0,
+ anchor = { 1, 1, 0 },
+ },
+ }
feed('<f1>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
spam^ |
{1:~ }|*5
{2:-- INSERT --} |
- ]], popupmenu={
- items=expected,
- pos=2,
- anchor={1,1,0},
- }}
+ ]],
+ popupmenu = {
+ items = expected,
+ pos = 2,
+ anchor = { 1, 1, 0 },
+ },
+ }
feed('<f2>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
spam^ |
{1:~ }|*5
{2:-- INSERT --} |
- ]], popupmenu={
- items=expected,
- pos=-1,
- anchor={1,1,0},
- }}
+ ]],
+ popupmenu = {
+ items = expected,
+ pos = -1,
+ anchor = { 1, 1, 0 },
+ },
+ }
feed('<f3>')
screen:expect([[
@@ -319,48 +378,59 @@ describe('ui/ext_popupmenu', function()
]])
feed('<Esc>:sign <Tab>')
- screen:expect({grid = [[
+ screen:expect({
+ grid = [[
|
bar |
{1:~ }|*5
:sign define^ |
- ]], popupmenu = {
- items = expected_wildpum,
- pos = 0,
- anchor = { 1, 7, 6 },
- }})
+ ]],
+ popupmenu = {
+ items = expected_wildpum,
+ pos = 0,
+ anchor = { 1, 7, 6 },
+ },
+ })
feed('<f1>')
- screen:expect({grid = [[
+ screen:expect({
+ grid = [[
|
bar |
{1:~ }|*5
:sign list^ |
- ]], popupmenu = {
- items = expected_wildpum,
- pos = 2,
- anchor = { 1, 7, 6 },
- }})
+ ]],
+ popupmenu = {
+ items = expected_wildpum,
+ pos = 2,
+ anchor = { 1, 7, 6 },
+ },
+ })
feed('<f2>')
- screen:expect({grid = [[
+ screen:expect({
+ grid = [[
|
bar |
{1:~ }|*5
:sign ^ |
- ]], popupmenu = {
- items = expected_wildpum,
- pos = -1,
- anchor = { 1, 7, 6 },
- }})
+ ]],
+ popupmenu = {
+ items = expected_wildpum,
+ pos = -1,
+ anchor = { 1, 7, 6 },
+ },
+ })
feed('<f3>')
- screen:expect({grid = [[
+ screen:expect({
+ grid = [[
|
bar |
{1:~ }|*5
:sign jump^ |
- ]]})
+ ]],
+ })
-- also should work for builtin popupmenu
screen:set_option('ext_popupmenu', false)
@@ -523,18 +593,18 @@ describe('ui/ext_popupmenu', function()
it('can set pum height', function()
source_complete_month()
local month_expected = {
- {'January', '', '', ''},
- {'February', '', '', ''},
- {'March', '', '', ''},
- {'April', '', '', ''},
- {'May', '', '', ''},
- {'June', '', '', ''},
- {'July', '', '', ''},
- {'August', '', '', ''},
- {'September', '', '', ''},
- {'October', '', '', ''},
- {'November', '', '', ''},
- {'December', '', '', ''},
+ { 'January', '', '', '' },
+ { 'February', '', '', '' },
+ { 'March', '', '', '' },
+ { 'April', '', '', '' },
+ { 'May', '', '', '' },
+ { 'June', '', '', '' },
+ { 'July', '', '', '' },
+ { 'August', '', '', '' },
+ { 'September', '', '', '' },
+ { 'October', '', '', '' },
+ { 'November', '', '', '' },
+ { 'December', '', '', '' },
}
local pum_height = 6
feed('o<C-r>=TestCompleteMonth()<CR>')
@@ -542,29 +612,30 @@ describe('ui/ext_popupmenu', function()
feed('<PageDown>')
-- pos becomes pum_height-2 because it is subtracting 2 to keep some
-- context in ins_compl_key2count()
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
January^ |
{1:~ }|*5
{2:-- INSERT --} |
- ]], popupmenu={
- items=month_expected,
- pos=pum_height-2,
- anchor={1,1,0},
- }}
+ ]],
+ popupmenu = {
+ items = month_expected,
+ pos = pum_height - 2,
+ anchor = { 1, 1, 0 },
+ },
+ }
end)
it('an error occurs if set 0 or less', function()
meths.ui_pum_set_height(1)
- eq('Expected pum height > 0',
- pcall_err(meths.ui_pum_set_height, 0))
+ eq('Expected pum height > 0', pcall_err(meths.ui_pum_set_height, 0))
end)
it('an error occurs when ext_popupmenu is false', function()
meths.ui_pum_set_height(1)
screen:set_option('ext_popupmenu', false)
- eq('It must support the ext_popupmenu option',
- pcall_err(meths.ui_pum_set_height, 1))
+ eq('It must support the ext_popupmenu option', pcall_err(meths.ui_pum_set_height, 1))
end)
end)
@@ -572,18 +643,18 @@ describe('ui/ext_popupmenu', function()
it('can set pum bounds', function()
source_complete_month()
local month_expected = {
- {'January', '', '', ''},
- {'February', '', '', ''},
- {'March', '', '', ''},
- {'April', '', '', ''},
- {'May', '', '', ''},
- {'June', '', '', ''},
- {'July', '', '', ''},
- {'August', '', '', ''},
- {'September', '', '', ''},
- {'October', '', '', ''},
- {'November', '', '', ''},
- {'December', '', '', ''},
+ { 'January', '', '', '' },
+ { 'February', '', '', '' },
+ { 'March', '', '', '' },
+ { 'April', '', '', '' },
+ { 'May', '', '', '' },
+ { 'June', '', '', '' },
+ { 'July', '', '', '' },
+ { 'August', '', '', '' },
+ { 'September', '', '', '' },
+ { 'October', '', '', '' },
+ { 'November', '', '', '' },
+ { 'December', '', '', '' },
}
local pum_height = 6
feed('o<C-r>=TestCompleteMonth()<CR>')
@@ -593,16 +664,19 @@ describe('ui/ext_popupmenu', function()
feed('<PageDown>')
-- pos becomes pum_height-2 because it is subtracting 2 to keep some
-- context in ins_compl_key2count()
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
January^ |
{1:~ }|*5
{2:-- INSERT --} |
- ]], popupmenu={
- items=month_expected,
- pos=pum_height-2,
- anchor={1,1,0},
- }}
+ ]],
+ popupmenu = {
+ items = month_expected,
+ pos = pum_height - 2,
+ anchor = { 1, 1, 0 },
+ },
+ }
end)
it('no error occurs if row or col set less than 0', function()
@@ -613,73 +687,79 @@ describe('ui/ext_popupmenu', function()
it('an error occurs if width or height set 0 or less', function()
meths.ui_pum_set_bounds(1.0, 1.0, 0.0, 1.5)
- eq('Expected width > 0',
- pcall_err(meths.ui_pum_set_bounds, 0.0, 1.0, 1.0, 0.0))
- eq('Expected height > 0',
- pcall_err(meths.ui_pum_set_bounds, 1.0, -1.0, 1.0, 0.0))
+ eq('Expected width > 0', pcall_err(meths.ui_pum_set_bounds, 0.0, 1.0, 1.0, 0.0))
+ eq('Expected height > 0', pcall_err(meths.ui_pum_set_bounds, 1.0, -1.0, 1.0, 0.0))
end)
it('an error occurs when ext_popupmenu is false', function()
meths.ui_pum_set_bounds(1.0, 1.0, 0.0, 1.5)
screen:set_option('ext_popupmenu', false)
- eq('UI must support the ext_popupmenu option',
- pcall_err(meths.ui_pum_set_bounds, 1.0, 1.0, 0.0, 1.5))
+ eq(
+ 'UI must support the ext_popupmenu option',
+ pcall_err(meths.ui_pum_set_bounds, 1.0, 1.0, 0.0, 1.5)
+ )
end)
end)
it('<PageUP>, <PageDown> works without ui_pum_set_height', function()
source_complete_month()
local month_expected = {
- {'January', '', '', ''},
- {'February', '', '', ''},
- {'March', '', '', ''},
- {'April', '', '', ''},
- {'May', '', '', ''},
- {'June', '', '', ''},
- {'July', '', '', ''},
- {'August', '', '', ''},
- {'September', '', '', ''},
- {'October', '', '', ''},
- {'November', '', '', ''},
- {'December', '', '', ''},
+ { 'January', '', '', '' },
+ { 'February', '', '', '' },
+ { 'March', '', '', '' },
+ { 'April', '', '', '' },
+ { 'May', '', '', '' },
+ { 'June', '', '', '' },
+ { 'July', '', '', '' },
+ { 'August', '', '', '' },
+ { 'September', '', '', '' },
+ { 'October', '', '', '' },
+ { 'November', '', '', '' },
+ { 'December', '', '', '' },
}
feed('o<C-r>=TestCompleteMonth()<CR>')
feed('<PageDown>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
January^ |
{1:~ }|*5
{2:-- INSERT --} |
- ]], popupmenu={
- items=month_expected,
- pos=3,
- anchor={1,1,0},
- }}
+ ]],
+ popupmenu = {
+ items = month_expected,
+ pos = 3,
+ anchor = { 1, 1, 0 },
+ },
+ }
feed('<PageUp>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
January^ |
{1:~ }|*5
{2:-- INSERT --} |
- ]], popupmenu={
- items=month_expected,
- pos=0,
- anchor={1,1,0},
- }}
+ ]],
+ popupmenu = {
+ items = month_expected,
+ pos = 0,
+ anchor = { 1, 1, 0 },
+ },
+ }
end)
it('works with wildoptions=pum', function()
- screen:try_resize(32,10)
+ screen:try_resize(32, 10)
command('set wildmenu')
command('set wildoptions=pum')
local wild_expected = {
- {'define', '', '', ''},
- {'jump', '', '', ''},
- {'list', '', '', ''},
- {'place', '', '', ''},
- {'undefine', '', '', ''},
- {'unplace', '', '', ''},
+ { 'define', '', '', '' },
+ { 'jump', '', '', '' },
+ { 'list', '', '', '' },
+ { 'place', '', '', '' },
+ { 'undefine', '', '', '' },
+ { 'unplace', '', '', '' },
}
feed(':sign ')
@@ -691,26 +771,35 @@ describe('ui/ext_popupmenu', function()
eq(0, funcs.wildmenumode())
feed('<tab>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
{1:~ }|*8
:sign define^ |
- ]], popupmenu={items=wild_expected, pos=0, anchor={1, 9, 6}}}
+ ]],
+ popupmenu = { items = wild_expected, pos = 0, anchor = { 1, 9, 6 } },
+ }
eq(1, funcs.wildmenumode())
feed('<left>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
{1:~ }|*8
:sign ^ |
- ]], popupmenu={items=wild_expected, pos=-1, anchor={1, 9, 6}}}
+ ]],
+ popupmenu = { items = wild_expected, pos = -1, anchor = { 1, 9, 6 } },
+ }
feed('<left>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
{1:~ }|*8
:sign unplace^ |
- ]], popupmenu={items=wild_expected, pos=5, anchor={1, 9, 6}}}
+ ]],
+ popupmenu = { items = wild_expected, pos = 5, anchor = { 1, 9, 6 } },
+ }
feed('x')
screen:expect([[
@@ -722,19 +811,23 @@ describe('ui/ext_popupmenu', function()
-- #10042: make sure shift-tab also triggers the pum
feed(':sign <S-tab>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
{1:~ }|*8
:sign unplace^ |
- ]], popupmenu={items=wild_expected, pos=5, anchor={1, 9, 6}}}
+ ]],
+ popupmenu = { items = wild_expected, pos = 5, anchor = { 1, 9, 6 } },
+ }
feed('<esc>')
eq(0, funcs.wildmenumode())
-- 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 = [[
|
{1:~ }|*3
{4:långfile2 }|
@@ -742,12 +835,13 @@ describe('ui/ext_popupmenu', function()
{1:~ }|*2
{3:långfile1 }|
:b långfile1^ |
- ]], popupmenu={
- anchor = {1, 9, 3},
- items = {{"långfile1", "", "", "" }, {"långfile2", "", "", ""}},
- pos = 0,
- }}
-
+ ]],
+ popupmenu = {
+ anchor = { 1, 9, 3 },
+ items = { { 'långfile1', '', '', '' }, { 'långfile2', '', '', '' } },
+ pos = 0,
+ },
+ }
end)
it('does not interfere with mousemodel=popup', function()
@@ -760,36 +854,44 @@ describe('ui/ext_popupmenu', function()
menu PopUp.baz :let g:menustr = 'baz'<CR>
]])
feed('o<C-r>=TestComplete()<CR>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
foo^ |
{1:~ }|*5
{2:-- INSERT --} |
- ]], popupmenu={
- items=expected,
- pos=0,
- anchor={1,1,0},
- }}
+ ]],
+ popupmenu = {
+ items = expected,
+ pos = 0,
+ anchor = { 1, 1, 0 },
+ },
+ }
feed('<c-p>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
^ |
{1:~ }|*5
{2:-- INSERT --} |
- ]], popupmenu={
- items=expected,
- pos=-1,
- anchor={1,1,0},
- }}
+ ]],
+ popupmenu = {
+ items = expected,
+ pos = -1,
+ anchor = { 1, 1, 0 },
+ },
+ }
feed('<esc>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
^ |
{1:~ }|*5
|
- ]]}
+ ]],
+ }
feed('<RightMouse><0,0>')
screen:expect([[
|
@@ -815,51 +917,51 @@ describe("builtin popupmenu 'pumblend'", function()
it('RGB-color', function()
local screen = Screen.new(60, 14)
screen:set_default_attr_ids({
- [1] = {background = Screen.colors.Yellow},
- [2] = {bold = true, reverse = true},
- [3] = {bold = true, foreground = Screen.colors.Brown},
- [4] = {foreground = Screen.colors.Blue1},
- [5] = {reverse = true},
- [6] = {background = Screen.colors.Gray55, foreground = Screen.colors.Grey45},
- [7] = {background = Screen.colors.Gray55, foreground = Screen.colors.Grey0},
- [8] = {background = tonumber('0x191919'), foreground = Screen.colors.Grey0},
- [9] = {background = tonumber('0xffc1ff'), foreground = tonumber('0xe5a8e5')},
- [10] = {background = tonumber('0xffc1ff'), foreground = Screen.colors.Grey0},
- [11] = {foreground = tonumber('0xffc1ff'), background = tonumber('0xe5a8e5'), bold = true},
- [12] = {foreground = Screen.colors.Grey55, background = Screen.colors.Gray45, bold = true},
- [13] = {background = tonumber('0xffc1e5'), foreground = Screen.colors.Grey0},
- [14] = {background = tonumber('0xffc1e5'), foreground = tonumber('0xe5a8e5')},
- [15] = {background = tonumber('0xffc1ff'), foreground = tonumber('0x080202')},
- [16] = {background = tonumber('0xffc1ff'), bold = true, foreground = tonumber('0xf6ace9')},
- [17] = {background = tonumber('0xffc1ff'), foreground = tonumber('0xe5a8ff')},
- [18] = {background = tonumber('0xe5a8e5'), foreground = tonumber('0xffc1ff')},
- [19] = {background = Screen.colors.Gray45, foreground = Screen.colors.Grey55},
- [20] = {bold = true},
- [21] = {bold = true, foreground = Screen.colors.SeaGreen4},
- [22] = {background = Screen.colors.WebGray},
- [23] = {background = Screen.colors.Grey0},
- [24] = {background = Screen.colors.LightMagenta},
- [25] = {background = Screen.colors.Gray75, foreground = Screen.colors.Grey25},
- [26] = {background = Screen.colors.Gray75, foreground = Screen.colors.Grey0},
- [27] = {background = Screen.colors.Gray50, foreground = Screen.colors.Grey0},
- [28] = {background = tonumber('0xffddff'), foreground = tonumber('0x7f5d7f')},
- [29] = {background = tonumber('0xffddff'), foreground = Screen.colors.Grey0},
- [30] = {foreground = tonumber('0xffddff'), background = tonumber('0x7f5d7f'), bold = true},
- [31] = {foreground = tonumber('0xffddff'), background = Screen.colors.Grey0, bold = true},
- [32] = {foreground = Screen.colors.Gray75, background = Screen.colors.Grey25, bold = true},
- [33] = {background = tonumber('0xffdd7f'), foreground = Screen.colors.Grey0},
- [34] = {background = tonumber('0xffdd7f'), foreground = tonumber('0x7f5d7f')},
- [35] = {background = tonumber('0xffddff'), bold = true, foreground = tonumber('0x290a0a')},
- [36] = {background = tonumber('0xffddff'), bold = true, foreground = tonumber('0xd27294')},
- [37] = {background = tonumber('0xffddff'), foreground = tonumber('0x7f5dff')},
- [38] = {background = tonumber('0x7f5d7f'), foreground = tonumber('0xffddff')},
- [39] = {background = Screen.colors.Grey0, foreground = tonumber('0xffddff')},
- [40] = {background = Screen.colors.Gray25, foreground = Screen.colors.Grey75},
- [41] = {background = tonumber('0xffddff'), foreground = tonumber('0x00003f')},
- [42] = {foreground = tonumber('0x0c0c0c'), background = tonumber('0xe5a8e5')},
- [43] = {background = tonumber('0x7f5d7f'), bold = true, foreground = tonumber('0x3f3f3f')},
- [44] = {foreground = tonumber('0x3f3f3f'), background = tonumber('0x7f5d7f')},
- [45] = {background = Screen.colors.WebGray, blend=0},
+ [1] = { background = Screen.colors.Yellow },
+ [2] = { bold = true, reverse = true },
+ [3] = { bold = true, foreground = Screen.colors.Brown },
+ [4] = { foreground = Screen.colors.Blue1 },
+ [5] = { reverse = true },
+ [6] = { background = Screen.colors.Gray55, foreground = Screen.colors.Grey45 },
+ [7] = { background = Screen.colors.Gray55, foreground = Screen.colors.Grey0 },
+ [8] = { background = tonumber('0x191919'), foreground = Screen.colors.Grey0 },
+ [9] = { background = tonumber('0xffc1ff'), foreground = tonumber('0xe5a8e5') },
+ [10] = { background = tonumber('0xffc1ff'), foreground = Screen.colors.Grey0 },
+ [11] = { foreground = tonumber('0xffc1ff'), background = tonumber('0xe5a8e5'), bold = true },
+ [12] = { foreground = Screen.colors.Grey55, background = Screen.colors.Gray45, bold = true },
+ [13] = { background = tonumber('0xffc1e5'), foreground = Screen.colors.Grey0 },
+ [14] = { background = tonumber('0xffc1e5'), foreground = tonumber('0xe5a8e5') },
+ [15] = { background = tonumber('0xffc1ff'), foreground = tonumber('0x080202') },
+ [16] = { background = tonumber('0xffc1ff'), bold = true, foreground = tonumber('0xf6ace9') },
+ [17] = { background = tonumber('0xffc1ff'), foreground = tonumber('0xe5a8ff') },
+ [18] = { background = tonumber('0xe5a8e5'), foreground = tonumber('0xffc1ff') },
+ [19] = { background = Screen.colors.Gray45, foreground = Screen.colors.Grey55 },
+ [20] = { bold = true },
+ [21] = { bold = true, foreground = Screen.colors.SeaGreen4 },
+ [22] = { background = Screen.colors.WebGray },
+ [23] = { background = Screen.colors.Grey0 },
+ [24] = { background = Screen.colors.LightMagenta },
+ [25] = { background = Screen.colors.Gray75, foreground = Screen.colors.Grey25 },
+ [26] = { background = Screen.colors.Gray75, foreground = Screen.colors.Grey0 },
+ [27] = { background = Screen.colors.Gray50, foreground = Screen.colors.Grey0 },
+ [28] = { background = tonumber('0xffddff'), foreground = tonumber('0x7f5d7f') },
+ [29] = { background = tonumber('0xffddff'), foreground = Screen.colors.Grey0 },
+ [30] = { foreground = tonumber('0xffddff'), background = tonumber('0x7f5d7f'), bold = true },
+ [31] = { foreground = tonumber('0xffddff'), background = Screen.colors.Grey0, bold = true },
+ [32] = { foreground = Screen.colors.Gray75, background = Screen.colors.Grey25, bold = true },
+ [33] = { background = tonumber('0xffdd7f'), foreground = Screen.colors.Grey0 },
+ [34] = { background = tonumber('0xffdd7f'), foreground = tonumber('0x7f5d7f') },
+ [35] = { background = tonumber('0xffddff'), bold = true, foreground = tonumber('0x290a0a') },
+ [36] = { background = tonumber('0xffddff'), bold = true, foreground = tonumber('0xd27294') },
+ [37] = { background = tonumber('0xffddff'), foreground = tonumber('0x7f5dff') },
+ [38] = { background = tonumber('0x7f5d7f'), foreground = tonumber('0xffddff') },
+ [39] = { background = Screen.colors.Grey0, foreground = tonumber('0xffddff') },
+ [40] = { background = Screen.colors.Gray25, foreground = Screen.colors.Grey75 },
+ [41] = { background = tonumber('0xffddff'), foreground = tonumber('0x00003f') },
+ [42] = { foreground = tonumber('0x0c0c0c'), background = tonumber('0xe5a8e5') },
+ [43] = { background = tonumber('0x7f5d7f'), bold = true, foreground = tonumber('0x3f3f3f') },
+ [44] = { foreground = tonumber('0x3f3f3f'), background = tonumber('0x7f5d7f') },
+ [45] = { background = Screen.colors.WebGray, blend = 0 },
})
screen:attach()
command('syntax on')
@@ -1013,18 +1115,18 @@ describe("builtin popupmenu 'pumblend'", function()
it('256-color (non-RGB)', function()
local screen = Screen.new(60, 8)
screen:set_default_attr_ids({
- [1] = {foreground = Screen.colors.Grey0, background = tonumber('0x000007')},
- [2] = {foreground = tonumber('0x000055'), background = tonumber('0x000007')},
- [3] = {foreground = tonumber('0x00008f'), background = Screen.colors.Grey0},
- [4] = {foreground = Screen.colors.Grey0, background = tonumber('0x0000e1')},
- [5] = {foreground = tonumber('0x0000d1'), background = tonumber('0x0000e1')},
- [6] = {foreground = Screen.colors.NavyBlue, background = tonumber('0x0000f8')},
- [7] = {foreground = tonumber('0x0000a5'), background = tonumber('0x0000f8')},
- [8] = {foreground = tonumber('0x00000c')},
- [9] = {bold = true},
- [10] = {foreground = tonumber('0x000002')},
+ [1] = { foreground = Screen.colors.Grey0, background = tonumber('0x000007') },
+ [2] = { foreground = tonumber('0x000055'), background = tonumber('0x000007') },
+ [3] = { foreground = tonumber('0x00008f'), background = Screen.colors.Grey0 },
+ [4] = { foreground = Screen.colors.Grey0, background = tonumber('0x0000e1') },
+ [5] = { foreground = tonumber('0x0000d1'), background = tonumber('0x0000e1') },
+ [6] = { foreground = Screen.colors.NavyBlue, background = tonumber('0x0000f8') },
+ [7] = { foreground = tonumber('0x0000a5'), background = tonumber('0x0000f8') },
+ [8] = { foreground = tonumber('0x00000c') },
+ [9] = { bold = true },
+ [10] = { foreground = tonumber('0x000002') },
})
- screen:attach({rgb=false})
+ screen:attach({ rgb = false })
command('set notermguicolors pumblend=10')
insert([[
Lorem ipsum dolor sit amet, consectetur
@@ -1056,21 +1158,21 @@ describe('builtin popupmenu', function()
screen = Screen.new(32, 20)
screen:set_default_attr_ids({
-- popup selected item / scrollbar track
- ['s'] = {background = Screen.colors.WebGray},
+ ['s'] = { background = Screen.colors.WebGray },
-- popup non-selected item
- ['n'] = {background = Screen.colors.LightMagenta},
+ ['n'] = { background = Screen.colors.LightMagenta },
-- popup scrollbar knob
- ['c'] = {background = Screen.colors.Grey0},
- [1] = {bold = true, foreground = Screen.colors.Blue},
- [2] = {bold = true},
- [3] = {reverse = true},
- [4] = {bold = true, reverse = true},
- [5] = {bold = true, foreground = Screen.colors.SeaGreen},
- [6] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
- [7] = {background = Screen.colors.Yellow}, -- Search
- [8] = {foreground = Screen.colors.Red},
+ ['c'] = { background = Screen.colors.Grey0 },
+ [1] = { bold = true, foreground = Screen.colors.Blue },
+ [2] = { bold = true },
+ [3] = { reverse = true },
+ [4] = { bold = true, reverse = true },
+ [5] = { bold = true, foreground = Screen.colors.SeaGreen },
+ [6] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
+ [7] = { background = Screen.colors.Yellow }, -- Search
+ [8] = { foreground = Screen.colors.Red },
})
- screen:attach({ext_multigrid=multigrid})
+ screen:attach({ ext_multigrid = multigrid })
end)
it('with preview-window above', function()
@@ -1078,7 +1180,8 @@ describe('builtin popupmenu', function()
feed('iaa bb cc dd ee ff gg hh ii jj<cr>')
feed('<c-x><c-n>')
if multigrid then
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
## grid 1
[4:--------------------------------]|*8
{3:[No Name] [Preview][+] }|
@@ -1104,9 +1207,11 @@ describe('builtin popupmenu', function()
{n:ff }{c: }|
{n:gg }{s: }|
{n:hh }{s: }|
- ]], float_pos={
- [5] = {{id = -1}, "NW", 2, 2, 0, false, 100};
- }}
+ ]],
+ float_pos = {
+ [5] = { { id = -1 }, 'NW', 2, 2, 0, false, 100 },
+ },
+ }
else
screen:expect([[
aa bb cc dd ee ff gg hh ii jj |
@@ -1133,7 +1238,8 @@ describe('builtin popupmenu', function()
feed('iaa bb cc dd ee ff gg hh ii jj<cr>')
feed('<c-x><c-n>')
if multigrid then
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
## grid 1
[2:--------------------------------]|*9
{4:[No Name] [+] }|
@@ -1159,9 +1265,11 @@ describe('builtin popupmenu', function()
{n:ff }{c: }|
{n:gg }{s: }|
{n:hh }{s: }|
- ]], float_pos={
- [5] = {{id = -1}, "NW", 2, 2, 0, false, 100};
- }}
+ ]],
+ float_pos = {
+ [5] = { { id = -1 }, 'NW', 2, 2, 0, false, 100 },
+ },
+ }
else
screen:expect([[
aa bb cc dd ee ff gg hh ii jj |
@@ -1190,7 +1298,8 @@ describe('builtin popupmenu', function()
feed('kk<cr>ll<cr>mm<cr>nn<cr>oo<cr>')
feed('<c-x><c-n>')
if multigrid then
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
## grid 1
[4:--------------------------------]|*4
{3:[No Name] [Preview][+] }|
@@ -1232,9 +1341,11 @@ describe('builtin popupmenu', function()
{n:kk }{c: }|
{n:ll }{s: }|
{n:mm }{s: }|
- ]], float_pos={
- [5] = {{id = -1}, "SW", 2, 12, 0, false, 100};
- }}
+ ]],
+ float_pos = {
+ [5] = { { id = -1 }, 'SW', 2, 12, 0, false, 100 },
+ },
+ }
else
screen:expect([[
aa |
@@ -1267,7 +1378,8 @@ describe('builtin popupmenu', function()
feed('ff<cr>gg<cr>hh<cr>ii<cr>jj<cr>')
feed('<c-x><c-n>')
if multigrid then
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
## grid 1
[4:--------------------------------]|*8
{3:[No Name] [Preview][+] }|
@@ -1305,9 +1417,11 @@ describe('builtin popupmenu', function()
{n:gg }{c: }|
{n:hh }{c: }|
{n:ii }{s: }|
- ]], float_pos={
- [5] = {{id = -1}, "SW", 2, 8, 0, false, 100};
- }}
+ ]],
+ float_pos = {
+ [5] = { { id = -1 }, 'SW', 2, 8, 0, false, 100 },
+ },
+ }
else
screen:expect([[
aa |
@@ -1340,7 +1454,8 @@ describe('builtin popupmenu', function()
feed('ff<cr>gg<cr>hh<cr>ii<cr>jj<cr>')
feed('<c-x><c-n>')
if multigrid then
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
## grid 1
[2:--------------------------------]|*9
{4:[No Name] [+] }|
@@ -1377,9 +1492,11 @@ describe('builtin popupmenu', function()
{n:ff }{c: }|
{n:gg }{s: }|
{n:hh }{s: }|
- ]], float_pos={
- [5] = {{id = -1}, "SW", 2, 8, 0, false, 100};
- }}
+ ]],
+ float_pos = {
+ [5] = { { id = -1 }, 'SW', 2, 8, 0, false, 100 },
+ },
+ }
else
screen:expect([[
{s:aa }{c: } |
@@ -1468,7 +1585,7 @@ describe('builtin popupmenu', function()
end)
end
- describe("floating window preview #popup", function()
+ describe('floating window preview #popup', function()
it('pum popup preview', function()
--row must > 10
screen:try_resize(30, 11)
@@ -1494,7 +1611,8 @@ describe('builtin popupmenu', function()
--floating preview in right
if multigrid then
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
## grid 1
[2:------------------------------]|*10
[3:------------------------------]|
@@ -1510,26 +1628,32 @@ describe('builtin popupmenu', function()
{s:one }|
{n:two }|
{n:three }|
- ]], float_pos={
- [5] = {{id = -1}, "NW", 2, 1, 0, false, 100};
- [4] = {{id = 1001}, "NW", 1, 1, 15, true, 50};
- }}
+ ]],
+ float_pos = {
+ [5] = { { id = -1 }, 'NW', 2, 1, 0, false, 100 },
+ [4] = { { id = 1001 }, 'NW', 1, 1, 15, true, 50 },
+ },
+ }
else
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
one^ |
{s:one }{n:1info}{1: }|
{n:two }{1: }|
{n:three }{1: }|
{1:~ }|*6
{2:-- }{5:match 1 of 3} |
- ]], unchanged = true}
+ ]],
+ unchanged = true,
+ }
end
-- test nvim_complete_set_info
feed('<C-N><C-N>')
helpers.sleep(10)
if multigrid then
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
## grid 1
[2:------------------------------]|*10
[3:------------------------------]|
@@ -1545,19 +1669,23 @@ describe('builtin popupmenu', function()
{n:one }|
{n:two }|
{s:three }|
- ]], float_pos={
- [5] = {{id = -1}, "NW", 2, 1, 0, false, 100};
- [4] = {{id = 1001}, "NW", 1, 1, 15, true, 50};
- }}
+ ]],
+ float_pos = {
+ [5] = { { id = -1 }, 'NW', 2, 1, 0, false, 100 },
+ [4] = { { id = 1001 }, 'NW', 1, 1, 15, true, 50 },
+ },
+ }
else
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
three^ |
{n:one 3info}{1: }|
{n:two }{1: }|
{s:three }{1: }|
{1:~ }|*6
{2:-- }{5:match 3 of 3} |
- ]]}
+ ]],
+ }
end
-- make sure info has set
feed('<C-y>')
@@ -1568,7 +1696,8 @@ describe('builtin popupmenu', function()
insert(('test'):rep(5))
feed('i<C-x><C-o>')
if multigrid then
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
## grid 1
[2:------------------------------]|*10
[3:------------------------------]|
@@ -1584,22 +1713,43 @@ describe('builtin popupmenu', function()
## grid 6
{n:1info}|
{n: }|
- ]], float_pos={
- [5] = {{id = -1}, "NW", 2, 1, 19, false, 100};
- [6] = {{id = 1002}, "NW", 1, 1, 1, true, 50};
- }, win_viewport={
- [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 23, linecount = 1, sum_scroll_delta = 0};
- [6] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
- }}
+ ]],
+ float_pos = {
+ [5] = { { id = -1 }, 'NW', 2, 1, 19, false, 100 },
+ [6] = { { id = 1002 }, 'NW', 1, 1, 1, true, 50 },
+ },
+ win_viewport = {
+ [2] = {
+ win = { id = 1000 },
+ topline = 0,
+ botline = 2,
+ curline = 0,
+ curcol = 23,
+ linecount = 1,
+ sum_scroll_delta = 0,
+ },
+ [6] = {
+ win = { id = 1002 },
+ topline = 0,
+ botline = 2,
+ curline = 0,
+ curcol = 0,
+ linecount = 1,
+ sum_scroll_delta = 0,
+ },
+ },
+ }
else
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
itesttesttesttesttesone^t |
{1:~}{n:1info}{1: }{s: one }{1: }|
{1:~}{n: }{1: }{n: two }{1: }|
{1:~ }{n: three }{1: }|
{1:~ }|*6
{2:-- }{5:match 1 of 3} |
- ]]}
+ ]],
+ }
end
end)
end)
@@ -1609,7 +1759,8 @@ describe('builtin popupmenu', function()
insert('aaa aab aac\n')
feed(':vsplit<cr>')
if multigrid then
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
## grid 1
[4:--------------------]│[2:-----------]|*6
{4:[No Name] [+] }{3:<Name] [+] }|
@@ -1624,7 +1775,8 @@ describe('builtin popupmenu', function()
aaa aab aac |
^ |
{1:~ }|*4
- ]]}
+ ]],
+ }
else
screen:expect([[
aaa aab aac │aaa aab aac|
@@ -1637,7 +1789,8 @@ describe('builtin popupmenu', function()
feed('ibbb a<c-x><c-n>')
if multigrid then
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
## grid 1
[4:--------------------]│[2:-----------]|*6
{4:[No Name] [+] }{3:<Name] [+] }|
@@ -1656,9 +1809,11 @@ describe('builtin popupmenu', function()
{s: aaa }|
{n: aab }|
{n: aac }|
- ]], float_pos={
- [5] = {{id = -1}, "NW", 4, 2, 3, false, 100};
- }}
+ ]],
+ float_pos = {
+ [5] = { { id = -1 }, 'NW', 4, 2, 3, false, 100 },
+ },
+ }
else
screen:expect([[
aaa aab aac │aaa aab aac|
@@ -1674,7 +1829,8 @@ describe('builtin popupmenu', function()
feed('<esc><c-w><c-w>oc a<c-x><c-n>')
if multigrid then
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
## grid 1
[4:-----------]│[2:--------------------]|*6
{3:<Name] [+] }{4:[No Name] [+] }|
@@ -1695,9 +1851,11 @@ describe('builtin popupmenu', function()
{s: aaa }|
{n: aab }|
{n: aac }|
- ]], float_pos={
- [5] = {{id = -1}, "NW", 2, 3, 1, false, 100};
- }}
+ ]],
+ float_pos = {
+ [5] = { { id = -1 }, 'NW', 2, 3, 1, false, 100 },
+ },
+ }
else
screen:expect([[
aaa aab aac│aaa aab aac |
@@ -1713,7 +1871,8 @@ describe('builtin popupmenu', function()
feed('bcdef ccc a<c-x><c-n>')
if multigrid then
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
## grid 1
[4:-----------]│[2:--------------------]|*6
{3:<Name] [+] }{4:[No Name] [+] }|
@@ -1736,9 +1895,11 @@ describe('builtin popupmenu', function()
{n: aab }|
{n: aac }|
{n: aaabcdef}|
- ]], float_pos={
- [5] = {{id = -1}, "NW", 2, 3, 11, false, 100};
- }}
+ ]],
+ float_pos = {
+ [5] = { { id = -1 }, 'NW', 2, 3, 11, false, 100 },
+ },
+ }
else
screen:expect([[
aaa aab aac│aaa aab aac |
@@ -1754,7 +1915,8 @@ describe('builtin popupmenu', function()
feed('\n<c-x><c-n>')
if multigrid then
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
## grid 1
[4:-----------]│[2:--------------------]|*6
{3:<Name] [+] }{4:[No Name] [+] }|
@@ -1778,9 +1940,11 @@ describe('builtin popupmenu', function()
{s: aaa }{c: }|
{n: aab }{s: }|
{n: aac }{s: }|
- ]], float_pos={
- [5] = {{id = -1}, "NW", 2, 4, -1, false, 100};
- }}
+ ]],
+ float_pos = {
+ [5] = { { id = -1 }, 'NW', 2, 4, -1, false, 100 },
+ },
+ }
else
screen:expect([[
aaa aab aac│aaa aab aac |
@@ -1797,10 +1961,10 @@ describe('builtin popupmenu', function()
if not multigrid then
it('with split and scroll', function()
- screen:try_resize(60,14)
- command("split")
- command("set completeopt+=noinsert")
- command("set mouse=a")
+ screen:try_resize(60, 14)
+ command('split')
+ command('set completeopt+=noinsert')
+ command('set mouse=a')
insert([[
Lorem ipsum dolor sit amet, consectetur
adipisicing elit, sed do eiusmod tempor
@@ -1994,7 +2158,10 @@ describe('builtin popupmenu', function()
{2:-- Keyword Local completion (^N^P) }{5:match 22 of 65} |
]])
- funcs.complete(4, {'ea', 'eeeeeeeeeeeeeeeeee', 'ei', 'eo', 'eu', 'ey', 'eå', 'eä', 'eö'})
+ funcs.complete(
+ 4,
+ { 'ea', 'eeeeeeeeeeeeeeeeee', 'ei', 'eo', 'eu', 'ey', 'eå', 'eä', 'eö' }
+ )
screen:expect([[
Est eu^ |
{s: ea }t amet, consectetur |
@@ -2012,7 +2179,7 @@ describe('builtin popupmenu', function()
{2:-- Keyword Local completion (^N^P) }{5:match 1 of 9} |
]])
- funcs.complete(4, {'ea', 'eee', 'ei', 'eo', 'eu', 'ey', 'eå', 'eä', 'eö'})
+ funcs.complete(4, { 'ea', 'eee', 'ei', 'eo', 'eu', 'ey', 'eå', 'eä', 'eö' })
screen:expect([[
Est eu^ |
{s: ea }r sit amet, consectetur |
@@ -2048,7 +2215,7 @@ describe('builtin popupmenu', function()
{2:-- INSERT --} |
]])
- funcs.complete(6, {'foo', 'bar'})
+ funcs.complete(6, { 'foo', 'bar' })
screen:expect([[
Esteee^ |
Lo{s: foo }sit amet, consectetur |
@@ -2087,9 +2254,9 @@ describe('builtin popupmenu', function()
it('can be moved due to wrap or resize', function()
feed('isome long prefix before the ')
- command("set completeopt+=noinsert,noselect")
- command("set linebreak")
- funcs.complete(29, {'word', 'choice', 'text', 'thing'})
+ command('set completeopt+=noinsert,noselect')
+ command('set linebreak')
+ funcs.complete(29, { 'word', 'choice', 'text', 'thing' })
screen:expect([[
some long prefix before the ^ |
{1:~ }{n: word }|
@@ -2123,7 +2290,7 @@ describe('builtin popupmenu', function()
{2:-- INSERT --} |
]])
- screen:try_resize(30,8)
+ screen:try_resize(30, 8)
screen:expect([[
some long prefix before the |
text^ |
@@ -2135,7 +2302,7 @@ describe('builtin popupmenu', function()
{2:-- INSERT --} |
]])
- screen:try_resize(50,8)
+ screen:try_resize(50, 8)
screen:expect([[
some long prefix before the text^ |
{1:~ }{n: word }{1: }|
@@ -2146,7 +2313,7 @@ describe('builtin popupmenu', function()
{2:-- INSERT --} |
]])
- screen:try_resize(25,10)
+ screen:try_resize(25, 10)
screen:expect([[
some long prefix before |
the text^ |
@@ -2158,7 +2325,7 @@ describe('builtin popupmenu', function()
{2:-- INSERT --} |
]])
- screen:try_resize(12,5)
+ screen:try_resize(12, 5)
screen:expect([[
some long |
prefix |
@@ -2168,14 +2335,14 @@ describe('builtin popupmenu', function()
]])
-- can't draw the pum, but check we don't crash
- screen:try_resize(12,2)
+ screen:try_resize(12, 2)
screen:expect([[
{1:<<<}t^ |
{2:-- INSERT --}|
]])
-- but state is preserved, pum reappears
- screen:try_resize(20,8)
+ screen:try_resize(20, 8)
screen:expect([[
some long prefix |
before the text^ |
@@ -2190,10 +2357,10 @@ describe('builtin popupmenu', function()
it('with VimResized autocmd', function()
feed('isome long prefix before the ')
- command("set completeopt+=noinsert,noselect")
- command("autocmd VimResized * redraw!")
- command("set linebreak")
- funcs.complete(29, {'word', 'choice', 'text', 'thing'})
+ command('set completeopt+=noinsert,noselect')
+ command('autocmd VimResized * redraw!')
+ command('set linebreak')
+ funcs.complete(29, { 'word', 'choice', 'text', 'thing' })
screen:expect([[
some long prefix before the ^ |
{1:~ }{n: word }|
@@ -2204,7 +2371,7 @@ describe('builtin popupmenu', function()
{2:-- INSERT --} |
]])
- screen:try_resize(16,10)
+ screen:try_resize(16, 10)
screen:expect([[
some long |
prefix before |
@@ -2219,7 +2386,7 @@ describe('builtin popupmenu', function()
end)
it('with rightleft window', function()
- command("set rl wildoptions+=pum")
+ command('set rl wildoptions+=pum')
feed('isome rightleft ')
screen:expect([[
^ tfelthgir emos|
@@ -2227,8 +2394,8 @@ describe('builtin popupmenu', function()
{2:-- INSERT --} |
]])
- command("set completeopt+=noinsert,noselect")
- funcs.complete(16, {'word', 'choice', 'text', 'thing'})
+ command('set completeopt+=noinsert,noselect')
+ funcs.complete(16, { 'word', 'choice', 'text', 'thing' })
screen:expect([[
^ tfelthgir emos|
{1: }{n: drow }{1: ~}|
@@ -2259,14 +2426,17 @@ describe('builtin popupmenu', function()
-- not rightleft on the cmdline
feed('<esc>:sign ')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
drow tfelthgir emos|
{1: ~}|*18
:sign ^ |
- ]]}
+ ]],
+ }
feed('<tab>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
drow tfelthgir emos|
{1: ~}|*12
{1: }{s: define }{1: ~}|
@@ -2276,7 +2446,8 @@ describe('builtin popupmenu', function()
{1: }{n: undefine }{1: ~}|
{1: }{n: unplace }{1: ~}|
:sign define^ |
- ]]}
+ ]],
+ }
end)
end
@@ -2287,9 +2458,10 @@ describe('builtin popupmenu', function()
command('set completeopt+=noinsert,noselect')
command('set pumheight=2')
feed('isome rightleft ')
- funcs.complete(16, {'word', 'choice', 'text', 'thing'})
+ funcs.complete(16, { 'word', 'choice', 'text', 'thing' })
if multigrid then
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
## grid 1
[2:-------------------]│[4:--------------------]|*4
{3:[No Name] [+] }{4:[No Name] [+] }|
@@ -2305,9 +2477,11 @@ describe('builtin popupmenu', function()
## grid 5
{c: }{n: drow }|
{s: }{n: eciohc }|
- ]], float_pos={
- [5] = {{id = -1}, "NW", 4, 1, -11, false, 100};
- }}
+ ]],
+ float_pos = {
+ [5] = { { id = -1 }, 'NW', 4, 1, -11, false, 100 },
+ },
+ }
else
screen:expect([[
tfelthgir emos│ ^ tfelthgir emos|
@@ -2319,9 +2493,10 @@ describe('builtin popupmenu', function()
]])
end
feed('<C-E><CR>')
- funcs.complete(1, {'word', 'choice', 'text', 'thing'})
+ funcs.complete(1, { 'word', 'choice', 'text', 'thing' })
if multigrid then
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
## grid 1
[2:-------------------]│[4:--------------------]|*4
{3:[No Name] [+] }{4:[No Name] [+] }|
@@ -2339,9 +2514,11 @@ describe('builtin popupmenu', function()
## grid 5
{c: }{n: drow}|
{s: }{n: eciohc}|
- ]], float_pos={
- [5] = {{id = -1}, "NW", 4, 2, 4, false, 100};
- }}
+ ]],
+ float_pos = {
+ [5] = { { id = -1 }, 'NW', 4, 2, 4, false, 100 },
+ },
+ }
else
screen:expect([[
tfelthgir emos│ tfelthgir emos|
@@ -2353,9 +2530,10 @@ describe('builtin popupmenu', function()
]])
end
feed('<C-E>')
- async_meths.call_function('input', {'', '', 'sign'})
+ async_meths.call_function('input', { '', '', 'sign' })
if multigrid then
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
## grid 1
[2:-------------------]│[4:--------------------]|*4
{3:[No Name] [+] }{4:[No Name] [+] }|
@@ -2370,7 +2548,8 @@ describe('builtin popupmenu', function()
tfelthgir emos|
|
{1: ~}|*2
- ]]}
+ ]],
+ }
else
screen:expect([[
tfelthgir emos│ tfelthgir emos|
@@ -2383,7 +2562,8 @@ describe('builtin popupmenu', function()
command('set wildoptions+=pum')
feed('<Tab>')
if multigrid then
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
## grid 1
[2:-------------------]│[4:--------------------]|*4
{3:[No Name] [+] }{4:[No Name] [+] }|
@@ -2401,9 +2581,11 @@ describe('builtin popupmenu', function()
## grid 5
{s:define }{c: }|
{n:jump }{s: }|
- ]], float_pos={
- [5] = {{id = -1}, "SW", 1, 5, 0, false, 250};
- }}
+ ]],
+ float_pos = {
+ [5] = { { id = -1 }, 'SW', 1, 5, 0, false, 250 },
+ },
+ }
else
screen:expect([[
tfelthgir emos│ tfelthgir emos|
@@ -2418,10 +2600,10 @@ describe('builtin popupmenu', function()
if not multigrid then
it('with multiline messages', function()
- screen:try_resize(40,8)
+ screen:try_resize(40, 8)
feed('ixx<cr>')
command('imap <f2> <cmd>echoerr "very"\\|echoerr "much"\\|echoerr "error"<cr>')
- funcs.complete(1, {'word', 'choice', 'text', 'thing'})
+ funcs.complete(1, { 'word', 'choice', 'text', 'thing' })
screen:expect([[
xx |
word^ |
@@ -2469,7 +2651,7 @@ describe('builtin popupmenu', function()
{2:-- INSERT --} |
]])
- command("split")
+ command('split')
screen:expect([[
xx |
choice^ |
@@ -2482,7 +2664,8 @@ describe('builtin popupmenu', function()
]])
meths.input_mouse('wheel', 'down', '', 0, 6, 15)
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
xx |
choice^ |
{n:word }{1: }|
@@ -2491,13 +2674,19 @@ describe('builtin popupmenu', function()
{n:thing }{1: }|
{3:[No Name] [+] }|
{2:-- INSERT --} |
- ]], unchanged=true}
+ ]],
+ unchanged = true,
+ }
end)
it('with kind, menu and abbr attributes', function()
- screen:try_resize(40,8)
+ screen:try_resize(40, 8)
feed('ixx ')
- funcs.complete(4, {{word='wordey', kind= 'x', menu='extrainfo'}, 'thing', {word='secret', abbr='sneaky', menu='bar'}})
+ funcs.complete(4, {
+ { word = 'wordey', kind = 'x', menu = 'extrainfo' },
+ 'thing',
+ { word = 'secret', abbr = 'sneaky', menu = 'bar' },
+ })
screen:expect([[
xx wordey^ |
{1:~ }{s: wordey x extrainfo }{1: }|
@@ -2536,11 +2725,11 @@ describe('builtin popupmenu', function()
end)
it('wildoptions=pum', function()
- screen:try_resize(32,10)
+ screen:try_resize(32, 10)
command('set wildmenu')
command('set wildoptions=pum')
command('set shellslash')
- command("cd test/functional/fixtures/wildpum")
+ command('cd test/functional/fixtures/wildpum')
feed(':sign ')
screen:expect([[
@@ -2999,8 +3188,8 @@ describe('builtin popupmenu', function()
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([[
|
@@ -3014,7 +3203,7 @@ describe('builtin popupmenu', function()
]])
-- check doesn't crash on screen resize
- screen:try_resize(20,6)
+ screen:try_resize(20, 6)
screen:expect([[
|
{1:~ }|
@@ -3024,7 +3213,7 @@ describe('builtin popupmenu', function()
:b långfile1^ |
]])
- screen:try_resize(50,15)
+ screen:try_resize(50, 15)
screen:expect([[
|
{1:~ }|
@@ -3052,7 +3241,7 @@ describe('builtin popupmenu', function()
]])
feed('<esc>')
- command("close")
+ command('close')
command('set wildmode=full')
-- special case: when patterns ends with "/", show menu items aligned
@@ -3068,22 +3257,25 @@ describe('builtin popupmenu', function()
end)
it('wildoptions=pum with scrolled messages', function()
- screen:try_resize(40,10)
+ screen:try_resize(40, 10)
command('set wildmenu')
command('set wildoptions=pum')
feed(':echoerr "fail"|echoerr "error"<cr>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
{1:~ }|*5
{4: }|
{6:fail} |
{6:error} |
{5:Press ENTER or type command to continue}^ |
- ]]}
+ ]],
+ }
feed(':sign <tab>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
{1:~ }|*2
{1:~ }{s: define }{1: }|
@@ -3093,21 +3285,24 @@ describe('builtin popupmenu', function()
{6:fail} {n: undefine } |
{6:error}{n: unplace } |
:sign define^ |
- ]]}
+ ]],
+ }
feed('d')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
{1:~ }|*5
{4: }|
{6:fail} |
{6:error} |
:sign defined^ |
- ]]}
+ ]],
+ }
end)
it('wildoptions=pum and wildmode=longest,full #11622', function()
- screen:try_resize(30,8)
+ screen:try_resize(30, 8)
command('set wildmenu')
command('set wildoptions=pum')
command('set wildmode=longest,full')
@@ -3115,33 +3310,39 @@ describe('builtin popupmenu', function()
-- With 'wildmode' set to 'longest,full', completing a match should display
-- the longest match, the wildmenu should not be displayed.
feed(':sign u<Tab>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
{1:~ }|*6
:sign un^ |
- ]]}
+ ]],
+ }
eq(0, funcs.wildmenumode())
-- pressing <Tab> should display the wildmenu
feed('<Tab>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
{1:~ }|*4
{1:~ }{s: undefine }{1: }|
{1:~ }{n: unplace }{1: }|
:sign undefine^ |
- ]]}
+ ]],
+ }
eq(1, funcs.wildmenumode())
-- pressing <Tab> second time should select the next entry in the menu
feed('<Tab>')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
|
{1:~ }|*4
{1:~ }{n: undefine }{1: }|
{1:~ }{s: unplace }{1: }|
:sign unplace^ |
- ]]}
+ ]],
+ }
end)
it('wildoptions=pum with a wrapped line in buffer vim-patch:8.2.4655', function()
@@ -3255,14 +3456,15 @@ describe('builtin popupmenu', function()
end
it("'pumheight'", function()
- screen:try_resize(32,8)
+ screen:try_resize(32, 8)
feed('isome long prefix before the ')
- command("set completeopt+=noinsert,noselect")
- command("set linebreak")
- command("set pumheight=2")
- funcs.complete(29, {'word', 'choice', 'text', 'thing'})
+ command('set completeopt+=noinsert,noselect')
+ command('set linebreak')
+ command('set pumheight=2')
+ funcs.complete(29, { 'word', 'choice', 'text', 'thing' })
if multigrid then
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
## grid 1
[2:--------------------------------]|*7
[3:--------------------------------]|
@@ -3274,9 +3476,11 @@ describe('builtin popupmenu', function()
## grid 4
{n: word }{c: }|
{n: choice}{s: }|
- ]], float_pos={
- [4] = {{id = -1}, "NW", 2, 1, 24, false, 100};
- }}
+ ]],
+ float_pos = {
+ [4] = { { id = -1 }, 'NW', 2, 1, 24, false, 100 },
+ },
+ }
else
screen:expect([[
some long prefix before the ^ |
@@ -3289,14 +3493,15 @@ describe('builtin popupmenu', function()
end)
it("'pumwidth'", function()
- screen:try_resize(32,8)
+ screen:try_resize(32, 8)
feed('isome long prefix before the ')
- command("set completeopt+=noinsert,noselect")
- command("set linebreak")
- command("set pumwidth=8")
- funcs.complete(29, {'word', 'choice', 'text', 'thing'})
+ command('set completeopt+=noinsert,noselect')
+ command('set linebreak')
+ command('set pumwidth=8')
+ funcs.complete(29, { 'word', 'choice', 'text', 'thing' })
if multigrid then
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
## grid 1
[2:--------------------------------]|*7
[3:--------------------------------]|
@@ -3310,9 +3515,11 @@ describe('builtin popupmenu', function()
{n: choice}|
{n: text }|
{n: thing }|
- ]], float_pos={
- [4] = {{id = -1}, "NW", 2, 1, 25, false, 100};
- }}
+ ]],
+ float_pos = {
+ [4] = { { id = -1 }, 'NW', 2, 1, 25, false, 100 },
+ },
+ }
else
screen:expect([[
some long prefix before the ^ |
@@ -3328,14 +3535,14 @@ describe('builtin popupmenu', function()
it('does not crash when displayed in the last column with rightleft #12032', function()
local col = 30
- local items = {'word', 'choice', 'text', 'thing'}
+ local items = { 'word', 'choice', 'text', 'thing' }
local max_len = 0
for _, v in ipairs(items) do
max_len = max_len < #v and #v or max_len
end
screen:try_resize(col, 8)
command('set rightleft')
- command('call setline(1, repeat(" ", &columns - '..max_len..'))')
+ command('call setline(1, repeat(" ", &columns - ' .. max_len .. '))')
feed('$i')
funcs.complete(col - max_len, items)
feed('<c-y>')
@@ -3346,9 +3553,10 @@ describe('builtin popupmenu', function()
screen:try_resize(32, 8)
command('set completeopt+=menuone,noselect')
feed('i' .. string.rep(' ', 13))
- funcs.complete(14, {'哦哦哦哦哦哦哦哦哦哦'})
+ funcs.complete(14, { '哦哦哦哦哦哦哦哦哦哦' })
if multigrid then
- screen:expect({grid=[[
+ screen:expect({
+ grid = [[
## grid 1
[2:--------------------------------]|*7
[3:--------------------------------]|
@@ -3359,7 +3567,9 @@ describe('builtin popupmenu', function()
{2:-- INSERT --} |
## grid 4
{n: 哦哦哦哦哦哦哦哦哦>}|
- ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 12, false, 100}}})
+ ]],
+ float_pos = { [4] = { { id = -1 }, 'NW', 2, 1, 12, false, 100 } },
+ })
else
screen:expect([[
^ |
@@ -3371,17 +3581,18 @@ describe('builtin popupmenu', function()
end)
it('truncates double-width character correctly with scrollbar', function()
- screen:try_resize(32,8)
+ screen:try_resize(32, 8)
command('set completeopt+=noselect')
command('set pumheight=4')
feed('i' .. string.rep(' ', 12))
local items = {}
for _ = 1, 8 do
- table.insert(items, {word = '哦哦哦哦哦哦哦哦哦哦', equal = 1, dup = 1})
+ table.insert(items, { word = '哦哦哦哦哦哦哦哦哦哦', equal = 1, dup = 1 })
end
funcs.complete(13, items)
if multigrid then
- screen:expect({grid=[[
+ screen:expect({
+ grid = [[
## grid 1
[2:--------------------------------]|*7
[3:--------------------------------]|
@@ -3393,7 +3604,9 @@ describe('builtin popupmenu', function()
## grid 4
{n: 哦哦哦哦哦哦哦哦哦>}{c: }|*2
{n: 哦哦哦哦哦哦哦哦哦>}{s: }|*2
- ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 11, false, 100}}})
+ ]],
+ float_pos = { [4] = { { id = -1 }, 'NW', 2, 1, 11, false, 100 } },
+ })
else
screen:expect([[
^ |
@@ -3419,7 +3632,8 @@ describe('builtin popupmenu', function()
if multigrid then
meths.input_mouse('right', 'press', '', 2, 0, 4)
- screen:expect({grid=[[
+ screen:expect({
+ grid = [[
## grid 1
[2:--------------------------------]|*5
[3:--------------------------------]|
@@ -3432,7 +3646,9 @@ describe('builtin popupmenu', function()
{n: foo }|
{n: bar }|
{n: baz }|
- ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 3, false, 250}}})
+ ]],
+ float_pos = { [4] = { { id = -1 }, 'NW', 2, 1, 3, false, 250 } },
+ })
else
feed('<RightMouse><4,0>')
screen:expect([[
@@ -3446,7 +3662,8 @@ describe('builtin popupmenu', function()
end
feed('<Down>')
if multigrid then
- screen:expect({grid=[[
+ screen:expect({
+ grid = [[
## grid 1
[2:--------------------------------]|*5
[3:--------------------------------]|
@@ -3459,7 +3676,9 @@ describe('builtin popupmenu', function()
{s: foo }|
{n: bar }|
{n: baz }|
- ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 3, false, 250}}})
+ ]],
+ float_pos = { [4] = { { id = -1 }, 'NW', 2, 1, 3, false, 250 } },
+ })
else
screen:expect([[
^popup menu test |
@@ -3472,7 +3691,8 @@ describe('builtin popupmenu', function()
end
feed('<Down>')
if multigrid then
- screen:expect({grid=[[
+ screen:expect({
+ grid = [[
## grid 1
[2:--------------------------------]|*5
[3:--------------------------------]|
@@ -3485,7 +3705,9 @@ describe('builtin popupmenu', function()
{n: foo }|
{s: bar }|
{n: baz }|
- ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 3, false, 250}}})
+ ]],
+ float_pos = { [4] = { { id = -1 }, 'NW', 2, 1, 3, false, 250 } },
+ })
else
screen:expect([[
^popup menu test |
@@ -3498,7 +3720,8 @@ describe('builtin popupmenu', function()
end
feed('<CR>')
if multigrid then
- screen:expect({grid=[[
+ screen:expect({
+ grid = [[
## grid 1
[2:--------------------------------]|*5
[3:--------------------------------]|
@@ -3507,7 +3730,8 @@ describe('builtin popupmenu', function()
{1:~ }|*4
## grid 3
:let g:menustr = 'bar' |
- ]]})
+ ]],
+ })
else
screen:expect([[
^popup menu test |
@@ -3519,7 +3743,8 @@ describe('builtin popupmenu', function()
if multigrid then
meths.input_mouse('right', 'press', '', 2, 2, 20)
- screen:expect({grid=[[
+ screen:expect({
+ grid = [[
## grid 1
[2:--------------------------------]|*5
[3:--------------------------------]|
@@ -3532,7 +3757,9 @@ describe('builtin popupmenu', function()
{n: foo }|
{n: bar }|
{n: baz }|
- ]], float_pos={[4] = {{id = -1}, 'NW', 2, 3, 19, false, 250}}})
+ ]],
+ float_pos = { [4] = { { id = -1 }, 'NW', 2, 3, 19, false, 250 } },
+ })
else
feed('<RightMouse><20,2>')
screen:expect([[
@@ -3545,7 +3772,8 @@ describe('builtin popupmenu', function()
end
if multigrid then
meths.input_mouse('left', 'press', '', 4, 2, 2)
- screen:expect({grid=[[
+ screen:expect({
+ grid = [[
## grid 1
[2:--------------------------------]|*5
[3:--------------------------------]|
@@ -3554,7 +3782,8 @@ describe('builtin popupmenu', function()
{1:~ }|*4
## grid 3
:let g:menustr = 'baz' |
- ]]})
+ ]],
+ })
else
feed('<LeftMouse><22,5>')
screen:expect([[
@@ -3567,7 +3796,8 @@ describe('builtin popupmenu', function()
if multigrid then
meths.input_mouse('right', 'press', '', 2, 0, 4)
- screen:expect({grid=[[
+ screen:expect({
+ grid = [[
## grid 1
[2:--------------------------------]|*5
[3:--------------------------------]|
@@ -3580,7 +3810,9 @@ describe('builtin popupmenu', function()
{n: foo }|
{n: bar }|
{n: baz }|
- ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 3, false, 250}}})
+ ]],
+ float_pos = { [4] = { { id = -1 }, 'NW', 2, 1, 3, false, 250 } },
+ })
else
feed('<RightMouse><4,0>')
screen:expect([[
@@ -3594,7 +3826,8 @@ describe('builtin popupmenu', function()
end
if multigrid then
meths.input_mouse('right', 'drag', '', 2, 3, 6)
- screen:expect({grid=[[
+ screen:expect({
+ grid = [[
## grid 1
[2:--------------------------------]|*5
[3:--------------------------------]|
@@ -3607,7 +3840,9 @@ describe('builtin popupmenu', function()
{n: foo }|
{n: bar }|
{s: baz }|
- ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 3, false, 250}}})
+ ]],
+ float_pos = { [4] = { { id = -1 }, 'NW', 2, 1, 3, false, 250 } },
+ })
else
feed('<RightDrag><6,3>')
screen:expect([[
@@ -3621,7 +3856,8 @@ describe('builtin popupmenu', function()
end
if multigrid then
meths.input_mouse('right', 'release', '', 2, 1, 6)
- screen:expect({grid=[[
+ screen:expect({
+ grid = [[
## grid 1
[2:--------------------------------]|*5
[3:--------------------------------]|
@@ -3630,7 +3866,8 @@ describe('builtin popupmenu', function()
{1:~ }|*4
## grid 3
:let g:menustr = 'foo' |
- ]]})
+ ]],
+ })
else
feed('<RightRelease><6,1>')
screen:expect([[
@@ -3644,7 +3881,8 @@ describe('builtin popupmenu', function()
eq(false, screen.options.mousemoveevent)
if multigrid then
meths.input_mouse('right', 'press', '', 2, 0, 4)
- screen:expect({grid=[[
+ screen:expect({
+ grid = [[
## grid 1
[2:--------------------------------]|*5
[3:--------------------------------]|
@@ -3657,7 +3895,9 @@ describe('builtin popupmenu', function()
{n: foo }|
{n: bar }|
{n: baz }|
- ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 3, false, 250}}})
+ ]],
+ float_pos = { [4] = { { id = -1 }, 'NW', 2, 1, 3, false, 250 } },
+ })
else
feed('<RightMouse><4,0>')
screen:expect([[
@@ -3672,7 +3912,8 @@ describe('builtin popupmenu', function()
eq(true, screen.options.mousemoveevent)
if multigrid then
meths.input_mouse('move', '', '', 2, 3, 6)
- screen:expect({grid=[[
+ screen:expect({
+ grid = [[
## grid 1
[2:--------------------------------]|*5
[3:--------------------------------]|
@@ -3685,7 +3926,9 @@ describe('builtin popupmenu', function()
{n: foo }|
{n: bar }|
{s: baz }|
- ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 3, false, 250}}})
+ ]],
+ float_pos = { [4] = { { id = -1 }, 'NW', 2, 1, 3, false, 250 } },
+ })
else
feed('<MouseMove><6,3>')
screen:expect([[
@@ -3700,7 +3943,8 @@ describe('builtin popupmenu', function()
eq(true, screen.options.mousemoveevent)
if multigrid then
meths.input_mouse('left', 'press', '', 2, 2, 6)
- screen:expect({grid=[[
+ screen:expect({
+ grid = [[
## grid 1
[2:--------------------------------]|*5
[3:--------------------------------]|
@@ -3709,7 +3953,8 @@ describe('builtin popupmenu', function()
{1:~ }|*4
## grid 3
:let g:menustr = 'bar' |
- ]]})
+ ]],
+ })
else
feed('<LeftMouse><6,2>')
screen:expect([[
@@ -3724,7 +3969,8 @@ describe('builtin popupmenu', function()
command('set laststatus=0 | botright split')
if multigrid then
meths.input_mouse('right', 'press', '', 5, 1, 20)
- screen:expect({grid=[[
+ screen:expect({
+ grid = [[
## grid 1
[2:--------------------------------]|*2
{3:[No Name] [+] }|
@@ -3742,7 +3988,9 @@ describe('builtin popupmenu', function()
## grid 5
^popup menu test |
{1:~ }|
- ]], float_pos={[4] = {{id = -1}, "SW", 5, 1, 19, false, 250}}})
+ ]],
+ float_pos = { [4] = { { id = -1 }, 'SW', 5, 1, 19, false, 250 } },
+ })
else
feed('<RightMouse><20,4>')
screen:expect([[
@@ -3756,7 +4004,8 @@ describe('builtin popupmenu', function()
end
if multigrid then
meths.input_mouse('left', 'press', '', 4, 2, 2)
- screen:expect({grid=[[
+ screen:expect({
+ grid = [[
## grid 1
[2:--------------------------------]|*2
{3:[No Name] [+] }|
@@ -3770,7 +4019,8 @@ describe('builtin popupmenu', function()
## grid 5
^popup menu test |
{1:~ }|
- ]]})
+ ]],
+ })
else
feed('<LeftMouse><22,3>')
screen:expect([[
@@ -3787,7 +4037,8 @@ describe('builtin popupmenu', function()
command('set winwidth=1 | rightbelow vsplit')
if multigrid then
meths.input_mouse('right', 'press', '', 6, 1, 14)
- screen:expect({grid=[[
+ screen:expect({
+ grid = [[
## grid 1
[2:--------------------------------]|*2
{3:[No Name] [+] }|
@@ -3808,7 +4059,9 @@ describe('builtin popupmenu', function()
## grid 6
^popup menu test |
{1:~ }|
- ]], float_pos={[4] = {{id = -1}, "SW", 6, 1, 12, false, 250}}})
+ ]],
+ float_pos = { [4] = { { id = -1 }, 'SW', 6, 1, 12, false, 250 } },
+ })
else
feed('<RightMouse><30,4>')
screen:expect([[
@@ -3822,7 +4075,8 @@ describe('builtin popupmenu', function()
end
if multigrid then
meths.input_mouse('left', 'press', '', 4, 0, 2)
- screen:expect({grid=[[
+ screen:expect({
+ grid = [[
## grid 1
[2:--------------------------------]|*2
{3:[No Name] [+] }|
@@ -3839,7 +4093,8 @@ describe('builtin popupmenu', function()
## grid 6
^popup menu test |
{1:~ }|
- ]]})
+ ]],
+ })
else
feed('<LeftMouse><31,1>')
screen:expect([[
@@ -3856,7 +4111,8 @@ describe('builtin popupmenu', function()
command('setlocal winbar=WINBAR')
if multigrid then
meths.input_mouse('right', 'press', '', 6, 1, 14)
- screen:expect({grid=[[
+ screen:expect({
+ grid = [[
## grid 1
[2:--------------------------------]|*2
{3:[No Name] [+] }|
@@ -3877,7 +4133,9 @@ describe('builtin popupmenu', function()
## grid 6
{2:WINBAR }|
^popup menu test |
- ]], float_pos={[4] = {{id = -1}, "SW", 6, 1, 12, false, 250}}})
+ ]],
+ float_pos = { [4] = { { id = -1 }, 'SW', 6, 1, 12, false, 250 } },
+ })
else
feed('<RightMouse><30,4>')
screen:expect([[
@@ -3891,7 +4149,8 @@ describe('builtin popupmenu', function()
end
if multigrid then
meths.input_mouse('left', 'press', '', 4, 1, 2)
- screen:expect({grid=[[
+ screen:expect({
+ grid = [[
## grid 1
[2:--------------------------------]|*2
{3:[No Name] [+] }|
@@ -3908,7 +4167,8 @@ describe('builtin popupmenu', function()
## grid 6
{2:WINBAR }|
^popup menu test |
- ]]})
+ ]],
+ })
else
feed('<LeftMouse><31,2>')
screen:expect([[
@@ -4100,19 +4360,22 @@ describe('builtin popupmenu', function()
hi PmenuExtraSel guifg=Black guibg=Grey
]])
local attrs = screen:get_default_attr_ids()
- attrs.kn = {foreground = Screen.colors.Red, background = Screen.colors.Magenta}
- attrs.ks = {foreground = Screen.colors.Red, background = Screen.colors.Grey}
- attrs.xn = {foreground = Screen.colors.White, background = Screen.colors.Magenta}
- attrs.xs = {foreground = Screen.colors.Black, background = Screen.colors.Grey}
+ attrs.kn = { foreground = Screen.colors.Red, background = Screen.colors.Magenta }
+ attrs.ks = { foreground = Screen.colors.Red, background = Screen.colors.Grey }
+ attrs.xn = { foreground = Screen.colors.White, background = Screen.colors.Magenta }
+ attrs.xs = { foreground = Screen.colors.Black, background = Screen.colors.Grey }
feed('iaw<C-X><C-u>')
- screen:expect([[
+ screen:expect(
+ [[
aword1^ |
{s:aword1 }{ks:W }{xs:extra text 1 }{1: }|
{n:aword2 }{kn:W }{xn:extra text 2 }{1: }|
{n:aword3 }{kn:W }{xn:extra text 3 }{1: }|
{1:~ }|*3
{2:-- }{5:match 1 of 3} |
- ]], attrs)
+ ]],
+ attrs
+ )
end)
end)
end