aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/functional/ui/popupmenu_spec.lua1549
1 files changed, 1401 insertions, 148 deletions
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua
index 17d1293862..f6c9236037 100644
--- a/test/functional/ui/popupmenu_spec.lua
+++ b/test/functional/ui/popupmenu_spec.lua
@@ -1543,23 +1543,66 @@ describe('builtin popupmenu', function()
end
end)
- if not multigrid then
- describe('popup and preview window do not overlap', function()
- before_each(function()
- screen:try_resize(53, 20)
- end)
+ describe('popup and preview window do not overlap', function()
+ before_each(function()
+ screen:try_resize(53, 20)
+ end)
- -- oldtest: Test_popup_and_previewwindow_dump_pedit()
- it('with :pedit', function()
- exec([[
- set previewheight=9
- silent! pedit
- call setline(1, map(repeat(["ab"], 10), "v:val .. v:key"))
- exec "norm! G\<C-E>\<C-E>"
- ]])
- feed('o')
- n.poke_eventloop()
- feed('<C-X><C-N>')
+ -- oldtest: Test_popup_and_previewwindow_dump_pedit()
+ it('with :pedit', function()
+ exec([[
+ set previewheight=9
+ silent! pedit
+ call setline(1, map(repeat(["ab"], 10), "v:val .. v:key"))
+ exec "norm! G\<C-E>\<C-E>"
+ ]])
+ feed('o')
+ n.poke_eventloop()
+ feed('<C-X><C-N>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [4:-----------------------------------------------------]|*9
+ {3:[No Name] [Preview][+] }|
+ [2:-----------------------------------------------------]|*8
+ {4:[No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ ab4 |
+ ab5 |
+ ab6 |
+ ab7 |
+ ab8 |
+ ab9 |
+ ab0^ |
+ {1:~ }|
+ ## grid 3
+ {2:-- Keyword Local completion (^N^P) }{5:match 1 of 10} |
+ ## grid 4
+ ab0 |
+ ab1 |
+ ab2 |
+ ab3 |
+ ab4 |
+ ab5 |
+ ab6 |
+ ab7 |
+ ab8 |
+ ## grid 5
+ {s:ab0 }{c: }|
+ {n:ab1 }{c: }|
+ {n:ab2 }{c: }|
+ {n:ab3 }{c: }|
+ {n:ab4 }{s: }|
+ {n:ab5 }{s: }|
+ {n:ab6 }{s: }|
+ ]],
+ float_pos = {
+ [5] = { -1, 'SW', 2, 6, 0, false, 100 },
+ },
+ })
+ else
screen:expect([[
ab0 |
ab1 |
@@ -1582,19 +1625,62 @@ describe('builtin popupmenu', function()
{4:[No Name] [+] }|
{2:-- Keyword Local completion (^N^P) }{5:match 1 of 10} |
]])
- end)
+ end
+ end)
- -- oldtest: Test_popup_and_previewwindow_dump_pbuffer()
- it('with :pbuffer', function()
- exec([[
- set previewheight=9
- silent! pbuffer
- call setline(1, map(repeat(["ab"], 10), "v:val .. v:key"))
- exec "norm! G\<C-E>\<C-E>\<C-E>"
- ]])
- feed('o')
- n.poke_eventloop()
- feed('<C-X><C-N>')
+ -- oldtest: Test_popup_and_previewwindow_dump_pbuffer()
+ it('with :pbuffer', function()
+ exec([[
+ set previewheight=9
+ silent! pbuffer
+ call setline(1, map(repeat(["ab"], 10), "v:val .. v:key"))
+ exec "norm! G\<C-E>\<C-E>\<C-E>"
+ ]])
+ feed('o')
+ n.poke_eventloop()
+ feed('<C-X><C-N>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [4:-----------------------------------------------------]|*9
+ {3:[No Name] [Preview][+] }|
+ [2:-----------------------------------------------------]|*8
+ {4:[No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ ab5 |
+ ab6 |
+ ab7 |
+ ab8 |
+ ab9 |
+ ab0^ |
+ {1:~ }|*2
+ ## grid 3
+ {2:-- Keyword Local completion (^N^P) }{5:match 1 of 10} |
+ ## grid 4
+ ab0 |
+ ab1 |
+ ab2 |
+ ab3 |
+ ab4 |
+ ab5 |
+ ab6 |
+ ab7 |
+ ab8 |
+ ## grid 5
+ {s:ab0 }{c: }|
+ {n:ab1 }{c: }|
+ {n:ab2 }{c: }|
+ {n:ab3 }{s: }|
+ {n:ab4 }{s: }|
+ {n:ab5 }{s: }|
+ ]],
+ float_pos = {
+ [5] = { -1, 'SW', 2, 5, 0, false, 100 },
+ },
+ })
+ else
screen:expect([[
ab0 |
ab1 |
@@ -1616,22 +1702,44 @@ describe('builtin popupmenu', function()
{4:[No Name] [+] }|
{2:-- Keyword Local completion (^N^P) }{5:match 1 of 10} |
]])
- end)
+ end
end)
+ end)
- -- oldtest: Test_pum_with_preview_win()
- it('preview window opened during completion', function()
- exec([[
- funct Omni_test(findstart, base)
- if a:findstart
- return col(".") - 1
- endif
- return [#{word: "one", info: "1info"}, #{word: "two", info: "2info"}, #{word: "three", info: "3info"}]
- endfunc
- set omnifunc=Omni_test
- set completeopt+=longest
- ]])
- feed('Gi<C-X><C-O>')
+ -- oldtest: Test_pum_with_preview_win()
+ it('preview window opened during completion', function()
+ exec([[
+ funct Omni_test(findstart, base)
+ if a:findstart
+ return col(".") - 1
+ endif
+ return [#{word: "one", info: "1info"}, #{word: "two", info: "2info"}, #{word: "three", info: "3info"}]
+ endfunc
+ set omnifunc=Omni_test
+ set completeopt+=longest
+ ]])
+ feed('Gi<C-X><C-O>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*19
+ [3:--------------------------------]|
+ ## grid 2
+ ^ |
+ {1:~ }|*18
+ ## grid 3
+ {2:-- }{8:Back at original} |
+ ## grid 4
+ {n:one }|
+ {n:two }|
+ {n:three }|
+ ]],
+ float_pos = {
+ [4] = { -1, 'NW', 2, 1, 0, false, 100 },
+ },
+ })
+ else
screen:expect([[
^ |
{n:one }{1: }|
@@ -1640,7 +1748,35 @@ describe('builtin popupmenu', function()
{1:~ }|*15
{2:-- }{8:Back at original} |
]])
- feed('<C-N>')
+ end
+ feed('<C-N>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [5:--------------------------------]|*3
+ {3:[Scratch] [Preview] }|
+ [2:--------------------------------]|*14
+ {4:[No Name] [+] }|
+ [3:--------------------------------]|
+ ## grid 2
+ one^ |
+ {1:~ }|*13
+ ## grid 3
+ {2:-- }{5:match 1 of 3} |
+ ## grid 4
+ {s:one }|
+ {n:two }|
+ {n:three }|
+ ## grid 5
+ 1info |
+ {1:~ }|*2
+ ]],
+ float_pos = {
+ [4] = { -1, 'NW', 2, 1, 0, false, 100 },
+ },
+ })
+ else
screen:expect([[
1info |
{1:~ }|*2
@@ -1653,18 +1789,52 @@ describe('builtin popupmenu', function()
{4:[No Name] [+] }|
{2:-- }{5:match 1 of 3} |
]])
- end)
+ end
+ end)
- -- oldtest: Test_scrollbar_on_wide_char()
- it('scrollbar overwrites half of double-width char below properly', function()
- screen:try_resize(32, 10)
- exec([[
- call setline(1, ['a', ' 啊啊啊',
- \ ' 哦哦哦',
- \ ' 呃呃呃'])
- call setline(5, range(10)->map({i, v -> 'aa' .. v .. 'bb'}))
- ]])
- feed('A<C-X><C-N>')
+ -- oldtest: Test_scrollbar_on_wide_char()
+ it('scrollbar overwrites half of double-width char below properly', function()
+ screen:try_resize(32, 10)
+ exec([[
+ call setline(1, ['a', ' 啊啊啊',
+ \ ' 哦哦哦',
+ \ ' 呃呃呃'])
+ call setline(5, range(10)->map({i, v -> 'aa' .. v .. 'bb'}))
+ ]])
+ feed('A<C-X><C-N>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*9
+ [3:--------------------------------]|
+ ## grid 2
+ aa0bb^ |
+ 啊啊啊 |
+ 哦哦哦 |
+ 呃呃呃 |
+ aa0bb |
+ aa1bb |
+ aa2bb |
+ aa3bb |
+ aa4bb |
+ ## grid 3
+ {2:-- }{5:match 1 of 10} |
+ ## grid 4
+ {s:aa0bb }{c: }|
+ {n:aa1bb }{c: }|
+ {n:aa2bb }{c: }|
+ {n:aa3bb }{c: }|
+ {n:aa4bb }{c: }|
+ {n:aa5bb }{c: }|
+ {n:aa6bb }{s: }|
+ {n:aa7bb }{s: }|
+ ]],
+ float_pos = {
+ [4] = { -1, 'NW', 2, 1, 0, false, 100 },
+ },
+ })
+ else
screen:expect([[
aa0bb^ |
{s:aa0bb }{c: }啊 |
@@ -1677,8 +1847,8 @@ describe('builtin popupmenu', function()
{n:aa7bb }{s: } |
{2:-- }{5:match 1 of 10} |
]])
- end)
- end
+ end
+ end)
describe('floating window preview popup', function()
it('pum popup preview', function()
@@ -2398,27 +2568,53 @@ describe('builtin popupmenu', function()
end
end)
- 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')
- insert([[
- Lorem ipsum dolor sit amet, consectetur
- adipisicing elit, sed do eiusmod tempor
- incididunt ut labore et dolore magna aliqua.
- Ut enim ad minim veniam, quis nostrud
- exercitation ullamco laboris nisi ut aliquip ex
- ea commodo consequat. Duis aute irure dolor in
- reprehenderit in voluptate velit esse cillum
- dolore eu fugiat nulla pariatur. Excepteur sint
- occaecat cupidatat non proident, sunt in culpa
- qui officia deserunt mollit anim id est
- laborum.
- .
- ]])
+ it('with split and scroll', function()
+ 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
+ incididunt ut labore et dolore magna aliqua.
+ Ut enim ad minim veniam, quis nostrud
+ exercitation ullamco laboris nisi ut aliquip ex
+ ea commodo consequat. Duis aute irure dolor in
+ reprehenderit in voluptate velit esse cillum
+ dolore eu fugiat nulla pariatur. Excepteur sint
+ occaecat cupidatat non proident, sunt in culpa
+ qui officia deserunt mollit anim id est
+ laborum.
+ .
+ ]])
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [4:------------------------------------------------------------]|*6
+ {4:[No Name] [+] }|
+ [2:------------------------------------------------------------]|*5
+ {3:[No Name] [+] }|
+ [3:------------------------------------------------------------]|
+ ## grid 2
+ Lorem ipsum dolor sit amet, consectetur |
+ adipisicing elit, sed do eiusmod tempor |
+ incididunt ut labore et dolore magna aliqua. |
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ## grid 3
+ |
+ ## grid 4
+ dolore eu fugiat nulla pariatur. Excepteur sint |
+ occaecat cupidatat non proident, sunt in culpa |
+ qui officia deserunt mollit anim id est |
+ laborum. |
+ . |
+ ^ |
+ ]],
+ })
+ else
screen:expect([[
dolore eu fugiat nulla pariatur. Excepteur sint |
occaecat cupidatat non proident, sunt in culpa |
@@ -2435,8 +2631,52 @@ describe('builtin popupmenu', function()
{3:[No Name] [+] }|
|
]])
+ end
- feed('ggOEst <c-x><c-p>')
+ feed('ggOEst <c-x><c-p>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [4:------------------------------------------------------------]|*6
+ {4:[No Name] [+] }|
+ [2:------------------------------------------------------------]|*5
+ {3:[No Name] [+] }|
+ [3:------------------------------------------------------------]|
+ ## grid 2
+ Est |
+ Lorem ipsum dolor sit amet, consectetur |
+ adipisicing elit, sed do eiusmod tempor |
+ incididunt ut labore et dolore magna aliqua. |
+ Ut enim ad minim veniam, quis nostrud |
+ ## grid 3
+ {2:-- Keyword Local completion (^N^P) }{5:match 1 of 65} |
+ ## grid 4
+ Est ^ |
+ Lorem ipsum dolor sit amet, consectetur |
+ adipisicing elit, sed do eiusmod tempor |
+ incididunt ut labore et dolore magna aliqua. |
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ## grid 5
+ {n: sunt }{s: }|
+ {n: in }{s: }|
+ {n: culpa }{s: }|
+ {n: qui }{s: }|
+ {n: officia }{s: }|
+ {n: deserunt }{s: }|
+ {n: mollit }{s: }|
+ {n: anim }{s: }|
+ {n: id }{s: }|
+ {n: est }{s: }|
+ {n: laborum }{c: }|
+ {s: Est }{c: }|
+ ]],
+ float_pos = {
+ [5] = { -1, 'NW', 4, 1, 3, false, 100 },
+ },
+ })
+ else
screen:expect([[
Est ^ |
L{n: sunt }{s: }sit amet, consectetur |
@@ -2453,7 +2693,52 @@ describe('builtin popupmenu', function()
{3:[No}{s: Est }{c: }{3: }|
{2:-- Keyword Local completion (^N^P) }{5:match 1 of 65} |
]])
+ end
+ if multigrid then
+ api.nvim_input_mouse('wheel', 'down', '', 2, 9, 33)
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [4:------------------------------------------------------------]|*6
+ {4:[No Name] [+] }|
+ [2:------------------------------------------------------------]|*5
+ {3:[No Name] [+] }|
+ [3:------------------------------------------------------------]|
+ ## grid 2
+ incididunt ut labore et dolore magna aliqua. |
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ea commodo consequat. Duis aute irure dolor in |
+ reprehenderit in voluptate velit esse cillum |
+ ## grid 3
+ {2:-- Keyword Local completion (^N^P) }{5:match 1 of 65} |
+ ## grid 4
+ Est ^ |
+ Lorem ipsum dolor sit amet, consectetur |
+ adipisicing elit, sed do eiusmod tempor |
+ incididunt ut labore et dolore magna aliqua. |
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ## grid 5
+ {n: sunt }{s: }|
+ {n: in }{s: }|
+ {n: culpa }{s: }|
+ {n: qui }{s: }|
+ {n: officia }{s: }|
+ {n: deserunt }{s: }|
+ {n: mollit }{s: }|
+ {n: anim }{s: }|
+ {n: id }{s: }|
+ {n: est }{s: }|
+ {n: laborum }{c: }|
+ {s: Est }{c: }|
+ ]],
+ float_pos = {
+ [5] = { -1, 'NW', 4, 1, 3, false, 100 },
+ },
+ })
+ else
api.nvim_input_mouse('wheel', 'down', '', 0, 9, 40)
screen:expect([[
Est ^ |
@@ -2471,8 +2756,50 @@ describe('builtin popupmenu', function()
{3:[No}{s: Est }{c: }{3: }|
{2:-- Keyword Local completion (^N^P) }{5:match 1 of 65} |
]])
+ end
- feed('e')
+ feed('e')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [4:------------------------------------------------------------]|*6
+ {4:[No Name] [+] }|
+ [2:------------------------------------------------------------]|*5
+ {3:[No Name] [+] }|
+ [3:------------------------------------------------------------]|
+ ## grid 2
+ incididunt ut labore et dolore magna aliqua. |
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ea commodo consequat. Duis aute irure dolor in |
+ reprehenderit in voluptate velit esse cillum |
+ ## grid 3
+ {2:-- Keyword Local completion (^N^P) }{5:match 1 of 65} |
+ ## grid 4
+ Est e^ |
+ Lorem ipsum dolor sit amet, consectetur |
+ adipisicing elit, sed do eiusmod tempor |
+ incididunt ut labore et dolore magna aliqua. |
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ## grid 5
+ {n: elit }|
+ {n: eiusmod }|
+ {n: et }|
+ {n: enim }|
+ {n: exercitation }|
+ {n: ex }|
+ {n: ea }|
+ {n: esse }|
+ {n: eu }|
+ {s: est }|
+ ]],
+ float_pos = {
+ [5] = { -1, 'NW', 4, 1, 3, false, 100 },
+ },
+ })
+ else
screen:expect([[
Est e^ |
L{n: elit } sit amet, consectetur |
@@ -2489,7 +2816,50 @@ describe('builtin popupmenu', function()
{3:[No Name] [+] }|
{2:-- Keyword Local completion (^N^P) }{5:match 1 of 65} |
]])
+ end
+ if multigrid then
+ api.nvim_input_mouse('wheel', 'up', '', 2, 9, 33)
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [4:------------------------------------------------------------]|*6
+ {4:[No Name] [+] }|
+ [2:------------------------------------------------------------]|*5
+ {3:[No Name] [+] }|
+ [3:------------------------------------------------------------]|
+ ## grid 2
+ Est e |
+ Lorem ipsum dolor sit amet, consectetur |
+ adipisicing elit, sed do eiusmod tempor |
+ incididunt ut labore et dolore magna aliqua. |
+ Ut enim ad minim veniam, quis nostrud |
+ ## grid 3
+ {2:-- Keyword Local completion (^N^P) }{5:match 1 of 65} |
+ ## grid 4
+ Est e^ |
+ Lorem ipsum dolor sit amet, consectetur |
+ adipisicing elit, sed do eiusmod tempor |
+ incididunt ut labore et dolore magna aliqua. |
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ## grid 5
+ {n: elit }|
+ {n: eiusmod }|
+ {n: et }|
+ {n: enim }|
+ {n: exercitation }|
+ {n: ex }|
+ {n: ea }|
+ {n: esse }|
+ {n: eu }|
+ {s: est }|
+ ]],
+ float_pos = {
+ [5] = { -1, 'NW', 4, 1, 3, false, 100 },
+ },
+ })
+ else
api.nvim_input_mouse('wheel', 'up', '', 0, 9, 40)
screen:expect([[
Est e^ |
@@ -2507,8 +2877,42 @@ describe('builtin popupmenu', function()
{3:[No Name] [+] }|
{2:-- Keyword Local completion (^N^P) }{5:match 1 of 65} |
]])
+ end
- feed('s')
+ feed('s')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [4:------------------------------------------------------------]|*6
+ {4:[No Name] [+] }|
+ [2:------------------------------------------------------------]|*5
+ {3:[No Name] [+] }|
+ [3:------------------------------------------------------------]|
+ ## grid 2
+ Est es |
+ Lorem ipsum dolor sit amet, consectetur |
+ adipisicing elit, sed do eiusmod tempor |
+ incididunt ut labore et dolore magna aliqua. |
+ Ut enim ad minim veniam, quis nostrud |
+ ## grid 3
+ {2:-- Keyword Local completion (^N^P) }{5:match 1 of 65} |
+ ## grid 4
+ Est es^ |
+ Lorem ipsum dolor sit amet, consectetur |
+ adipisicing elit, sed do eiusmod tempor |
+ incididunt ut labore et dolore magna aliqua. |
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ## grid 5
+ {n: esse }|
+ {s: est }|
+ ]],
+ float_pos = {
+ [5] = { -1, 'NW', 4, 1, 3, false, 100 },
+ },
+ })
+ else
screen:expect([[
Est es^ |
L{n: esse } sit amet, consectetur |
@@ -2525,7 +2929,42 @@ describe('builtin popupmenu', function()
{3:[No Name] [+] }|
{2:-- Keyword Local completion (^N^P) }{5:match 1 of 65} |
]])
+ end
+ if multigrid then
+ api.nvim_input_mouse('wheel', 'down', '', 2, 9, 33)
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [4:------------------------------------------------------------]|*6
+ {4:[No Name] [+] }|
+ [2:------------------------------------------------------------]|*5
+ {3:[No Name] [+] }|
+ [3:------------------------------------------------------------]|
+ ## grid 2
+ incididunt ut labore et dolore magna aliqua. |
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ea commodo consequat. Duis aute irure dolor in |
+ reprehenderit in voluptate velit esse cillum |
+ ## grid 3
+ {2:-- Keyword Local completion (^N^P) }{5:match 1 of 65} |
+ ## grid 4
+ Est es^ |
+ Lorem ipsum dolor sit amet, consectetur |
+ adipisicing elit, sed do eiusmod tempor |
+ incididunt ut labore et dolore magna aliqua. |
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ## grid 5
+ {n: esse }|
+ {s: est }|
+ ]],
+ float_pos = {
+ [5] = { -1, 'NW', 4, 1, 3, false, 100 },
+ },
+ })
+ else
api.nvim_input_mouse('wheel', 'down', '', 0, 9, 40)
screen:expect([[
Est es^ |
@@ -2543,8 +2982,50 @@ describe('builtin popupmenu', function()
{3:[No Name] [+] }|
{2:-- Keyword Local completion (^N^P) }{5:match 1 of 65} |
]])
+ end
- feed('<bs>')
+ feed('<bs>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [4:------------------------------------------------------------]|*6
+ {4:[No Name] [+] }|
+ [2:------------------------------------------------------------]|*5
+ {3:[No Name] [+] }|
+ [3:------------------------------------------------------------]|
+ ## grid 2
+ incididunt ut labore et dolore magna aliqua. |
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ea commodo consequat. Duis aute irure dolor in |
+ reprehenderit in voluptate velit esse cillum |
+ ## grid 3
+ {2:-- Keyword Local completion (^N^P) }{5:match 1 of 65} |
+ ## grid 4
+ Est e^ |
+ Lorem ipsum dolor sit amet, consectetur |
+ adipisicing elit, sed do eiusmod tempor |
+ incididunt ut labore et dolore magna aliqua. |
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ## grid 5
+ {n: elit }|
+ {n: eiusmod }|
+ {n: et }|
+ {n: enim }|
+ {n: exercitation }|
+ {n: ex }|
+ {n: ea }|
+ {n: esse }|
+ {n: eu }|
+ {s: est }|
+ ]],
+ float_pos = {
+ [5] = { -1, 'NW', 4, 1, 3, false, 100 },
+ },
+ })
+ else
screen:expect([[
Est e^ |
L{n: elit } sit amet, consectetur |
@@ -2561,8 +3042,50 @@ describe('builtin popupmenu', function()
{3:[No Name] [+] }|
{2:-- Keyword Local completion (^N^P) }{5:match 1 of 65} |
]])
+ end
- feed('<c-p>')
+ feed('<c-p>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [4:------------------------------------------------------------]|*6
+ {4:[No Name] [+] }|
+ [2:------------------------------------------------------------]|*5
+ {3:[No Name] [+] }|
+ [3:------------------------------------------------------------]|
+ ## grid 2
+ incididunt ut labore et dolore magna aliqua. |
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ea commodo consequat. Duis aute irure dolor in |
+ reprehenderit in voluptate velit esse cillum |
+ ## grid 3
+ {2:-- Keyword Local completion (^N^P) }{5:match 22 of 65} |
+ ## grid 4
+ Est eu^ |
+ Lorem ipsum dolor sit amet, consectetur |
+ adipisicing elit, sed do eiusmod tempor |
+ incididunt ut labore et dolore magna aliqua. |
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ## grid 5
+ {n: elit }|
+ {n: eiusmod }|
+ {n: et }|
+ {n: enim }|
+ {n: exercitation }|
+ {n: ex }|
+ {n: ea }|
+ {n: esse }|
+ {s: eu }|
+ {n: est }|
+ ]],
+ float_pos = {
+ [5] = { -1, 'NW', 4, 1, 3, false, 100 },
+ },
+ })
+ else
screen:expect([[
Est eu^ |
L{n: elit } sit amet, consectetur |
@@ -2579,7 +3102,50 @@ describe('builtin popupmenu', function()
{3:[No Name] [+] }|
{2:-- Keyword Local completion (^N^P) }{5:match 22 of 65} |
]])
+ end
+ if multigrid then
+ api.nvim_input_mouse('wheel', 'down', '', 2, 9, 33)
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [4:------------------------------------------------------------]|*6
+ {4:[No Name] [+] }|
+ [2:------------------------------------------------------------]|*5
+ {3:[No Name] [+] }|
+ [3:------------------------------------------------------------]|
+ ## grid 2
+ ea commodo consequat. Duis aute irure dolor in |
+ reprehenderit in voluptate velit esse cillum |
+ dolore eu fugiat nulla pariatur. Excepteur sint |
+ occaecat cupidatat non proident, sunt in culpa |
+ qui officia deserunt mollit anim id est |
+ ## grid 3
+ {2:-- Keyword Local completion (^N^P) }{5:match 22 of 65} |
+ ## grid 4
+ Est eu^ |
+ Lorem ipsum dolor sit amet, consectetur |
+ adipisicing elit, sed do eiusmod tempor |
+ incididunt ut labore et dolore magna aliqua. |
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ## grid 5
+ {n: elit }|
+ {n: eiusmod }|
+ {n: et }|
+ {n: enim }|
+ {n: exercitation }|
+ {n: ex }|
+ {n: ea }|
+ {n: esse }|
+ {s: eu }|
+ {n: est }|
+ ]],
+ float_pos = {
+ [5] = { -1, 'NW', 4, 1, 3, false, 100 },
+ },
+ })
+ else
api.nvim_input_mouse('wheel', 'down', '', 0, 9, 40)
screen:expect([[
Est eu^ |
@@ -2597,8 +3163,49 @@ describe('builtin popupmenu', function()
{3:[No Name] [+] }|
{2:-- Keyword Local completion (^N^P) }{5:match 22 of 65} |
]])
+ end
- fn.complete(4, { 'ea', 'eeeeeeeeeeeeeeeeee', 'ei', 'eo', 'eu', 'ey', 'eå', 'eä', 'eö' })
+ fn.complete(4, { 'ea', 'eeeeeeeeeeeeeeeeee', 'ei', 'eo', 'eu', 'ey', 'eå', 'eä', 'eö' })
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [4:------------------------------------------------------------]|*6
+ {4:[No Name] [+] }|
+ [2:------------------------------------------------------------]|*5
+ {3:[No Name] [+] }|
+ [3:------------------------------------------------------------]|
+ ## grid 2
+ ea commodo consequat. Duis aute irure dolor in |
+ reprehenderit in voluptate velit esse cillum |
+ dolore eu fugiat nulla pariatur. Excepteur sint |
+ occaecat cupidatat non proident, sunt in culpa |
+ qui officia deserunt mollit anim id est |
+ ## grid 3
+ {2:-- Keyword Local completion (^N^P) }{5:match 1 of 9} |
+ ## grid 4
+ Est eu^ |
+ Lorem ipsum dolor sit amet, consectetur |
+ adipisicing elit, sed do eiusmod tempor |
+ incididunt ut labore et dolore magna aliqua. |
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ## grid 5
+ {s: ea }|
+ {n: eeeeeeeeeeeeeeeeee }|
+ {n: ei }|
+ {n: eo }|
+ {n: eu }|
+ {n: ey }|
+ {n: eå }|
+ {n: eä }|
+ {n: eö }|
+ ]],
+ float_pos = {
+ [5] = { -1, 'NW', 4, 1, 2, false, 100 },
+ },
+ })
+ else
screen:expect([[
Est eu^ |
{s: ea }t amet, consectetur |
@@ -2615,8 +3222,49 @@ describe('builtin popupmenu', function()
{3:[No Name] [+] }|
{2:-- Keyword Local completion (^N^P) }{5:match 1 of 9} |
]])
+ end
- fn.complete(4, { 'ea', 'eee', 'ei', 'eo', 'eu', 'ey', 'eå', 'eä', 'eö' })
+ fn.complete(4, { 'ea', 'eee', 'ei', 'eo', 'eu', 'ey', 'eå', 'eä', 'eö' })
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [4:------------------------------------------------------------]|*6
+ {4:[No Name] [+] }|
+ [2:------------------------------------------------------------]|*5
+ {3:[No Name] [+] }|
+ [3:------------------------------------------------------------]|
+ ## grid 2
+ ea commodo consequat. Duis aute irure dolor in |
+ reprehenderit in voluptate velit esse cillum |
+ dolore eu fugiat nulla pariatur. Excepteur sint |
+ occaecat cupidatat non proident, sunt in culpa |
+ qui officia deserunt mollit anim id est |
+ ## grid 3
+ {2:-- INSERT --} |
+ ## grid 4
+ Est eu^ |
+ Lorem ipsum dolor sit amet, consectetur |
+ adipisicing elit, sed do eiusmod tempor |
+ incididunt ut labore et dolore magna aliqua. |
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ## grid 5
+ {s: ea }|
+ {n: eee }|
+ {n: ei }|
+ {n: eo }|
+ {n: eu }|
+ {n: ey }|
+ {n: eå }|
+ {n: eä }|
+ {n: eö }|
+ ]],
+ float_pos = {
+ [5] = { -1, 'NW', 4, 1, 2, false, 100 },
+ },
+ })
+ else
screen:expect([[
Est eu^ |
{s: ea }r sit amet, consectetur |
@@ -2633,8 +3281,49 @@ describe('builtin popupmenu', function()
{3:[No Name] [+] }|
{2:-- INSERT --} |
]])
+ end
- feed('<c-n>')
+ feed('<c-n>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [4:------------------------------------------------------------]|*6
+ {4:[No Name] [+] }|
+ [2:------------------------------------------------------------]|*5
+ {3:[No Name] [+] }|
+ [3:------------------------------------------------------------]|
+ ## grid 2
+ ea commodo consequat. Duis aute irure dolor in |
+ reprehenderit in voluptate velit esse cillum |
+ dolore eu fugiat nulla pariatur. Excepteur sint |
+ occaecat cupidatat non proident, sunt in culpa |
+ qui officia deserunt mollit anim id est |
+ ## grid 3
+ {2:-- INSERT --} |
+ ## grid 4
+ Esteee^ |
+ Lorem ipsum dolor sit amet, consectetur |
+ adipisicing elit, sed do eiusmod tempor |
+ incididunt ut labore et dolore magna aliqua. |
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ## grid 5
+ {n: ea }|
+ {s: eee }|
+ {n: ei }|
+ {n: eo }|
+ {n: eu }|
+ {n: ey }|
+ {n: eå }|
+ {n: eä }|
+ {n: eö }|
+ ]],
+ float_pos = {
+ [5] = { -1, 'NW', 4, 1, 2, false, 100 },
+ },
+ })
+ else
screen:expect([[
Esteee^ |
{n: ea }r sit amet, consectetur |
@@ -2651,8 +3340,42 @@ describe('builtin popupmenu', function()
{3:[No Name] [+] }|
{2:-- INSERT --} |
]])
+ end
- fn.complete(6, { 'foo', 'bar' })
+ fn.complete(6, { 'foo', 'bar' })
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [4:------------------------------------------------------------]|*6
+ {4:[No Name] [+] }|
+ [2:------------------------------------------------------------]|*5
+ {3:[No Name] [+] }|
+ [3:------------------------------------------------------------]|
+ ## grid 2
+ ea commodo consequat. Duis aute irure dolor in |
+ reprehenderit in voluptate velit esse cillum |
+ dolore eu fugiat nulla pariatur. Excepteur sint |
+ occaecat cupidatat non proident, sunt in culpa |
+ qui officia deserunt mollit anim id est |
+ ## grid 3
+ {2:-- INSERT --} |
+ ## grid 4
+ Esteee^ |
+ Lorem ipsum dolor sit amet, consectetur |
+ adipisicing elit, sed do eiusmod tempor |
+ incididunt ut labore et dolore magna aliqua. |
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ## grid 5
+ {s: foo }|
+ {n: bar }|
+ ]],
+ float_pos = {
+ [5] = { -1, 'NW', 4, 1, 4, false, 100 },
+ },
+ })
+ else
screen:expect([[
Esteee^ |
Lo{s: foo }sit amet, consectetur |
@@ -2669,8 +3392,36 @@ describe('builtin popupmenu', function()
{3:[No Name] [+] }|
{2:-- INSERT --} |
]])
+ end
- feed('<c-y>')
+ feed('<c-y>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [4:------------------------------------------------------------]|*6
+ {4:[No Name] [+] }|
+ [2:------------------------------------------------------------]|*5
+ {3:[No Name] [+] }|
+ [3:------------------------------------------------------------]|
+ ## grid 2
+ ea commodo consequat. Duis aute irure dolor in |
+ reprehenderit in voluptate velit esse cillum |
+ dolore eu fugiat nulla pariatur. Excepteur sint |
+ occaecat cupidatat non proident, sunt in culpa |
+ qui officia deserunt mollit anim id est |
+ ## grid 3
+ {2:-- INSERT --} |
+ ## grid 4
+ Esteefoo^ |
+ Lorem ipsum dolor sit amet, consectetur |
+ adipisicing elit, sed do eiusmod tempor |
+ incididunt ut labore et dolore magna aliqua. |
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ]],
+ })
+ else
screen:expect([[
Esteefoo^ |
Lorem ipsum dolor sit amet, consectetur |
@@ -2687,13 +3438,36 @@ describe('builtin popupmenu', function()
{3:[No Name] [+] }|
{2:-- INSERT --} |
]])
- end)
+ end
+ end)
- it('can be moved due to wrap or resize', function()
- feed('isome long prefix before the ')
- command('set completeopt+=noinsert,noselect')
- command('set linebreak')
- fn.complete(29, { 'word', 'choice', 'text', 'thing' })
+ it('can be moved due to wrap or resize', function()
+ feed('isome long prefix before the ')
+ command('set completeopt+=noinsert,noselect')
+ command('set linebreak')
+ fn.complete(29, { 'word', 'choice', 'text', 'thing' })
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*19
+ [3:--------------------------------]|
+ ## grid 2
+ some long prefix before the ^ |
+ {1:~ }|*18
+ ## grid 3
+ {2:-- INSERT --} |
+ ## grid 4
+ {n: word }|
+ {n: choice}|
+ {n: text }|
+ {n: thing }|
+ ]],
+ float_pos = {
+ [4] = { -1, 'NW', 2, 1, 25, false, 100 },
+ },
+ })
+ else
screen:expect([[
some long prefix before the ^ |
{1:~ }{n: word }|
@@ -2703,8 +3477,32 @@ describe('builtin popupmenu', function()
{1:~ }|*14
{2:-- INSERT --} |
]])
+ end
- feed('<c-p>')
+ feed('<c-p>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*19
+ [3:--------------------------------]|
+ ## grid 2
+ some long prefix before the |
+ thing^ |
+ {1:~ }|*17
+ ## grid 3
+ {2:-- INSERT --} |
+ ## grid 4
+ {n:word }|
+ {n:choice }|
+ {n:text }|
+ {s:thing }|
+ ]],
+ float_pos = {
+ [4] = { -1, 'NW', 2, 2, 0, false, 100 },
+ },
+ })
+ else
screen:expect([[
some long prefix before the |
thing^ |
@@ -2715,8 +3513,32 @@ describe('builtin popupmenu', function()
{1:~ }|*13
{2:-- INSERT --} |
]])
+ end
- feed('<c-p>')
+ feed('<c-p>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*19
+ [3:--------------------------------]|
+ ## grid 2
+ some long prefix before the text|
+ {1:^~ }|
+ {1:~ }|*17
+ ## grid 3
+ {2:-- INSERT --} |
+ ## grid 4
+ {n: word }|
+ {n: choice}|
+ {s: text }|
+ {n: thing }|
+ ]],
+ float_pos = {
+ [4] = { -1, 'NW', 2, 1, 25, false, 100 },
+ },
+ })
+ else
screen:expect([[
some long prefix before the text|
{1:^~ }{n: word }|
@@ -2726,8 +3548,32 @@ describe('builtin popupmenu', function()
{1:~ }|*14
{2:-- INSERT --} |
]])
+ end
- screen:try_resize(30, 8)
+ screen:try_resize(30, 8)
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:------------------------------]|*7
+ [3:------------------------------]|
+ ## grid 2
+ some long prefix before the |
+ text^ |
+ {1:~ }|*5
+ ## grid 3
+ {2:-- INSERT --} |
+ ## grid 4
+ {n:word }|
+ {n:choice }|
+ {s:text }|
+ {n:thing }|
+ ]],
+ float_pos = {
+ [4] = { -1, 'NW', 2, 2, 0, false, 100 },
+ },
+ })
+ else
screen:expect([[
some long prefix before the |
text^ |
@@ -2738,8 +3584,31 @@ describe('builtin popupmenu', function()
{1:~ }|
{2:-- INSERT --} |
]])
+ end
- screen:try_resize(50, 8)
+ screen:try_resize(50, 8)
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------------------------]|*7
+ [3:--------------------------------------------------]|
+ ## grid 2
+ some long prefix before the text^ |
+ {1:~ }|*6
+ ## grid 3
+ {2:-- INSERT --} |
+ ## grid 4
+ {n: word }|
+ {n: choice }|
+ {s: text }|
+ {n: thing }|
+ ]],
+ float_pos = {
+ [4] = { -1, 'NW', 2, 1, 27, false, 100 },
+ },
+ })
+ else
screen:expect([[
some long prefix before the text^ |
{1:~ }{n: word }{1: }|
@@ -2749,8 +3618,32 @@ describe('builtin popupmenu', function()
{1:~ }|*2
{2:-- INSERT --} |
]])
+ end
- screen:try_resize(25, 10)
+ screen:try_resize(25, 10)
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:-------------------------]|*9
+ [3:-------------------------]|
+ ## grid 2
+ some long prefix before |
+ the text^ |
+ {1:~ }|*7
+ ## grid 3
+ {2:-- INSERT --} |
+ ## grid 4
+ {n: word }|
+ {n: choice }|
+ {s: text }|
+ {n: thing }|
+ ]],
+ float_pos = {
+ [4] = { -1, 'NW', 2, 2, 3, false, 100 },
+ },
+ })
+ else
screen:expect([[
some long prefix before |
the text^ |
@@ -2761,8 +3654,33 @@ describe('builtin popupmenu', function()
{1:~ }|*3
{2:-- INSERT --} |
]])
+ end
- screen:try_resize(12, 5)
+ screen:try_resize(12, 5)
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:------------]|*4
+ [3:------------]|
+ ## grid 2
+ some long |
+ prefix |
+ before the |
+ text^ |
+ ## grid 3
+ {2:-- INSERT --}|
+ ## grid 4
+ {n: word }|
+ {n: choice }|
+ {s: text }|
+ {n: thing }|
+ ]],
+ float_pos = {
+ [4] = { -1, 'NW', 2, 2, 3, false, 100 },
+ },
+ })
+ else
screen:expect([[
some long |
prefix |
@@ -2770,16 +3688,62 @@ describe('builtin popupmenu', function()
tex{n: }^ |
{2:-- INSERT --}|
]])
+ end
- -- can't draw the pum, but check we don't crash
- screen:try_resize(12, 2)
+ -- can't draw the pum, but check we don't crash
+ screen:try_resize(12, 2)
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:------------]|
+ [3:------------]|
+ ## grid 2
+ {1:<<<}t^ |
+ ## grid 3
+ {2:-- INSERT --}|
+ ## grid 4
+ {n: word }|
+ {n: choice }|
+ {s: text }|
+ {n: thing }|
+ ]],
+ float_pos = {
+ [4] = { -1, 'NW', 2, 2, 3, false, 100 },
+ },
+ })
+ else
screen:expect([[
{1:<<<}t^ |
{2:-- INSERT --}|
]])
+ end
- -- but state is preserved, pum reappears
- screen:try_resize(20, 8)
+ -- but state is preserved, pum reappears
+ screen:try_resize(20, 8)
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------]|*7
+ [3:--------------------]|
+ ## grid 2
+ some long prefix |
+ before the text^ |
+ {1:~ }|*5
+ ## grid 3
+ {2:-- INSERT --} |
+ ## grid 4
+ {n: word }|
+ {n: choice }|
+ {s: text }|
+ {n: thing }|
+ ]],
+ float_pos = {
+ [4] = { -1, 'NW', 2, 2, 10, false, 100 },
+ },
+ })
+ else
screen:expect([[
some long prefix |
before the text^ |
@@ -2790,14 +3754,37 @@ describe('builtin popupmenu', function()
{1:~ }|
{2:-- INSERT --} |
]])
- end)
+ end
+ end)
- it('with VimResized autocmd', function()
- feed('isome long prefix before the ')
- command('set completeopt+=noinsert,noselect')
- command('autocmd VimResized * redraw!')
- command('set linebreak')
- fn.complete(29, { 'word', 'choice', 'text', 'thing' })
+ it('with VimResized autocmd', function()
+ feed('isome long prefix before the ')
+ command('set completeopt+=noinsert,noselect')
+ command('autocmd VimResized * redraw!')
+ command('set linebreak')
+ fn.complete(29, { 'word', 'choice', 'text', 'thing' })
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*19
+ [3:--------------------------------]|
+ ## grid 2
+ some long prefix before the ^ |
+ {1:~ }|*18
+ ## grid 3
+ {2:-- INSERT --} |
+ ## grid 4
+ {n: word }|
+ {n: choice}|
+ {n: text }|
+ {n: thing }|
+ ]],
+ float_pos = {
+ [4] = { -1, 'NW', 2, 1, 25, false, 100 },
+ },
+ })
+ else
screen:expect([[
some long prefix before the ^ |
{1:~ }{n: word }|
@@ -2807,8 +3794,33 @@ describe('builtin popupmenu', function()
{1:~ }|*14
{2:-- INSERT --} |
]])
+ end
- screen:try_resize(16, 10)
+ screen:try_resize(16, 10)
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:----------------]|*9
+ [3:----------------]|
+ ## grid 2
+ some long |
+ prefix before |
+ the ^ |
+ {1:~ }|*6
+ ## grid 3
+ {2:-- INSERT --} |
+ ## grid 4
+ {n: word }|
+ {n: choice }|
+ {n: text }|
+ {n: thing }|
+ ]],
+ float_pos = {
+ [4] = { -1, 'NW', 2, 3, 3, false, 100 },
+ },
+ })
+ else
screen:expect([[
some long |
prefix before |
@@ -2820,19 +3832,57 @@ describe('builtin popupmenu', function()
{1:~ }|*2
{2:-- INSERT --} |
]])
- end)
+ end
+ end)
- it('with rightleft window', function()
- command('set rl wildoptions+=pum')
- feed('isome rightleft ')
+ it('with rightleft window', function()
+ command('set rl wildoptions+=pum')
+ feed('isome rightleft ')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*19
+ [3:--------------------------------]|
+ ## grid 2
+ ^ tfelthgir emos|
+ {1: ~}|*18
+ ## grid 3
+ {2:-- INSERT --} |
+ ]],
+ })
+ else
screen:expect([[
^ tfelthgir emos|
{1: ~}|*18
{2:-- INSERT --} |
]])
+ end
- command('set completeopt+=noinsert,noselect')
- fn.complete(16, { 'word', 'choice', 'text', 'thing' })
+ command('set completeopt+=noinsert,noselect')
+ fn.complete(16, { 'word', 'choice', 'text', 'thing' })
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*19
+ [3:--------------------------------]|
+ ## grid 2
+ ^ tfelthgir emos|
+ {1: ~}|*18
+ ## grid 3
+ {2:-- INSERT --} |
+ ## grid 4
+ {n: drow }|
+ {n: eciohc }|
+ {n: txet }|
+ {n: gniht }|
+ ]],
+ float_pos = {
+ [4] = { -1, 'NW', 2, 1, 2, false, 100 },
+ },
+ })
+ else
screen:expect([[
^ tfelthgir emos|
{1: }{n: drow }{1: ~}|
@@ -2842,8 +3892,31 @@ describe('builtin popupmenu', function()
{1: ~}|*14
{2:-- INSERT --} |
]])
+ end
- feed('<c-n>')
+ feed('<c-n>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*19
+ [3:--------------------------------]|
+ ## grid 2
+ ^ drow tfelthgir emos|
+ {1: ~}|*18
+ ## grid 3
+ {2:-- INSERT --} |
+ ## grid 4
+ {s: drow }|
+ {n: eciohc }|
+ {n: txet }|
+ {n: gniht }|
+ ]],
+ float_pos = {
+ [4] = { -1, 'NW', 2, 1, 2, false, 100 },
+ },
+ })
+ else
screen:expect([[
^ drow tfelthgir emos|
{1: }{s: drow }{1: ~}|
@@ -2853,16 +3926,46 @@ describe('builtin popupmenu', function()
{1: ~}|*14
{2:-- INSERT --} |
]])
+ end
- feed('<c-y>')
+ feed('<c-y>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*19
+ [3:--------------------------------]|
+ ## grid 2
+ ^ drow tfelthgir emos|
+ {1: ~}|*18
+ ## grid 3
+ {2:-- INSERT --} |
+ ]],
+ })
+ else
screen:expect([[
^ drow tfelthgir emos|
{1: ~}|*18
{2:-- INSERT --} |
]])
+ end
- -- not rightleft on the cmdline
- feed('<esc>:sign ')
+ -- not rightleft on the cmdline
+ feed('<esc>:sign ')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*19
+ [3:--------------------------------]|
+ ## grid 2
+ drow tfelthgir emos|
+ {1: ~}|*18
+ ## grid 3
+ :sign ^ |
+ ]],
+ })
+ else
screen:expect {
grid = [[
drow tfelthgir emos|
@@ -2870,9 +3973,34 @@ describe('builtin popupmenu', function()
:sign ^ |
]],
}
+ end
- -- oldtest: Test_wildmenu_pum_rightleft()
- feed('<tab>')
+ -- oldtest: Test_wildmenu_pum_rightleft()
+ feed('<tab>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*19
+ [3:--------------------------------]|
+ ## grid 2
+ drow tfelthgir emos|
+ {1: ~}|*18
+ ## grid 3
+ :sign define^ |
+ ## grid 4
+ {s: define }|
+ {n: jump }|
+ {n: list }|
+ {n: place }|
+ {n: undefine }|
+ {n: unplace }|
+ ]],
+ float_pos = {
+ [4] = { -1, 'SW', 1, 19, 5, false, 250 },
+ },
+ })
+ else
screen:expect {
grid = [[
drow tfelthgir emos|
@@ -2886,8 +4014,8 @@ describe('builtin popupmenu', function()
:sign define^ |
]],
}
- end)
- end
+ end
+ end)
it('with rightleft vsplits', function()
screen:try_resize(40, 6)
@@ -3695,13 +4823,30 @@ describe('builtin popupmenu', function()
:e compdir/file1^ |
]])
end)
+ end
- it('wildoptions=pum with scrolled messages', function()
- screen:try_resize(40, 10)
- command('set wildmenu')
- command('set wildoptions=pum')
+ it('wildoptions=pum with scrolled messages', function()
+ screen:try_resize(40, 10)
+ command('set wildmenu')
+ command('set wildoptions=pum')
- feed(':echoerr "fail"|echoerr "error"<cr>')
+ feed(':echoerr "fail"|echoerr "error"<cr>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:----------------------------------------]|*7
+ [3:----------------------------------------]|*3
+ ## grid 2
+ |
+ {1:~ }|*8
+ ## grid 3
+ {6:fail} |
+ {6:error} |
+ {5:Press ENTER or type command to continue}^ |
+ ]],
+ })
+ else
screen:expect {
grid = [[
|
@@ -3712,8 +4857,35 @@ describe('builtin popupmenu', function()
{5:Press ENTER or type command to continue}^ |
]],
}
+ end
- feed(':sign <tab>')
+ feed(':sign <tab>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:----------------------------------------]|*7
+ [3:----------------------------------------]|*3
+ ## grid 2
+ |
+ {1:~ }|*8
+ ## grid 3
+ {6:fail} |
+ {6:error} |
+ :sign define^ |
+ ## grid 4
+ {s: define }|
+ {n: jump }|
+ {n: list }|
+ {n: place }|
+ {n: undefine }|
+ {n: unplace }|
+ ]],
+ float_pos = {
+ [4] = { -1, 'SW', 1, 9, 5, false, 250 },
+ },
+ })
+ else
screen:expect {
grid = [[
|
@@ -3727,8 +4899,25 @@ describe('builtin popupmenu', function()
:sign define^ |
]],
}
+ end
- feed('d')
+ feed('d')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:----------------------------------------]|*7
+ [3:----------------------------------------]|*3
+ ## grid 2
+ |
+ {1:~ }|*8
+ ## grid 3
+ {6:fail} |
+ {6:error} |
+ :sign defined^ |
+ ]],
+ })
+ else
screen:expect {
grid = [[
|
@@ -3739,8 +4928,10 @@ describe('builtin popupmenu', function()
:sign defined^ |
]],
}
- end)
+ end
+ end)
+ if not multigrid then
it('wildoptions=pum and wildmode=longest,full #11622', function()
screen:try_resize(30, 8)
command('set wildmenu')
@@ -5187,19 +6378,49 @@ describe('builtin popupmenu', function()
feed('<Esc>')
end)
+ end
- -- oldtest: Test_mouse_popup_position()
- it('position of right-click menu when clicking near edge', function()
- screen:try_resize(50, 20)
- exec([[
- set mousemodel=popup_setpos
- " Delete the default MenuPopup event handler.
- autocmd! nvim.popupmenu
- aunmenu *
- source $VIMRUNTIME/menu.vim
- call setline(1, join(range(20)))
- ]])
+ -- oldtest: Test_mouse_popup_position()
+ it('position of right-click menu when clicking near edge', function()
+ screen:try_resize(50, 20)
+ exec([[
+ set mousemodel=popup_setpos
+ " Delete the default MenuPopup event handler.
+ autocmd! nvim.popupmenu
+ aunmenu *
+ source $VIMRUNTIME/menu.vim
+ call setline(1, join(range(20)))
+ ]])
+ if multigrid then
+ api.nvim_input_mouse('right', 'press', '', 2, 0, 45 - 1)
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------------------------]|*19
+ [3:--------------------------------------------------]|
+ ## grid 2
+ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ^18 19 |
+ {1:~ }|*18
+ ## grid 3
+ |
+ ## grid 4
+ {n: Undo }|
+ {n: }|
+ {n: Paste }|
+ {n: }|
+ {n: Select Word }|
+ {n: Select Sentence }|
+ {n: Select Paragraph}|
+ {n: Select Line }|
+ {n: Select Block }|
+ {n: Select All }|
+ ]],
+ float_pos = {
+ [4] = { -1, 'NW', 2, 1, 33, false, 250 },
+ },
+ })
+ else
api.nvim_input_mouse('right', 'press', '', 0, 0, 45 - 1)
screen:expect([[
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ^18 19 |
@@ -5216,9 +6437,39 @@ describe('builtin popupmenu', function()
{1:~ }|*8
|
]])
- feed('<Esc>')
+ end
+ feed('<Esc>')
- command('set rightleft')
+ command('set rightleft')
+ if multigrid then
+ api.nvim_input_mouse('right', 'press', '', 2, 0, 50 - 45)
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------------------------]|*19
+ [3:--------------------------------------------------]|
+ ## grid 2
+ 91 8^1 71 61 51 41 31 21 11 01 9 8 7 6 5 4 3 2 1 0|
+ {1: ~}|*18
+ ## grid 3
+ |
+ ## grid 4
+ {n: odnU }|
+ {n: }|
+ {n: etsaP }|
+ {n: }|
+ {n: droW tceleS }|
+ {n: ecnetneS tceleS }|
+ {n:hpargaraP tceleS }|
+ {n: eniL tceleS }|
+ {n: kcolB tceleS }|
+ {n: llA tceleS }|
+ ]],
+ float_pos = {
+ [4] = { -1, 'NW', 2, 1, 0, false, 250 },
+ },
+ })
+ else
api.nvim_input_mouse('right', 'press', '', 0, 0, 50 - 45)
screen:expect([[
91 8^1 71 61 51 41 31 21 11 01 9 8 7 6 5 4 3 2 1 0|
@@ -5235,10 +6486,12 @@ describe('builtin popupmenu', function()
{1: ~}|*8
|
]])
- feed('<Esc>')
- command('set norightleft')
- end)
+ end
+ feed('<Esc>')
+ command('set norightleft')
+ end)
+ if not multigrid then
describe('"kind" and "menu"', function()
before_each(function()
screen:try_resize(30, 8)