fix(mouse): fix popup_setpos position check with ext_multigrid

(cherry picked from commit 50f6609032)
This commit is contained in:
zeertzjq
2023-05-02 14:11:42 +08:00
committed by github-actions[bot]
parent 49092de818
commit 5267e7b07a
2 changed files with 398 additions and 7 deletions

View File

@@ -2235,7 +2235,7 @@ describe('ext_multigrid', function()
{1:~ }|
]]}
meths.input_mouse('left', 'press', '', 1,8, 26)
meths.input_mouse('left', 'press', '', 1, 8, 26)
poke_eventloop()
meths.input_mouse('left', 'drag', '', 1, 6, 30)
screen:expect{grid=[[
@@ -2276,6 +2276,400 @@ describe('ext_multigrid', function()
{1:~ }|
{1:~ }|
]]}
command('aunmenu PopUp | vmenu PopUp.Copy y')
funcs.setreg('"', '')
meths.input_mouse('left', 'press', '2', 2, 1, 6)
screen:expect{grid=[[
## grid 1
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
{12:[No Name] [+] }|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
{12:[No Name] [+] }{11:[No Name] [+] }|
[3:-----------------------------------------------------]|
## grid 2
some text |
to be {20:clicke}^d |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
{7:-- VISUAL --} |
## grid 4
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmo |
{1:~ }|
## grid 5
some text |
to be {20:clicked} |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]]}
meths.input_mouse('right', 'press', '', 2, 1, 6)
meths.input_mouse('right', 'release', '', 2, 1, 6)
screen:expect{grid=[[
## grid 1
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
{12:[No Name] [+] }|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
{12:[No Name] [+] }{11:[No Name] [+] }|
[3:-----------------------------------------------------]|
## grid 2
some text |
to be {20:clicke}^d |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
{7:-- VISUAL --} |
## grid 4
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmo |
{1:~ }|
## grid 5
some text |
to be {20:clicked} |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 6
{21: Copy }|
]], float_pos={
[6] = {{id = -1}, "NW", 2, 2, 5, false, 250};
}}
feed('<Down><CR>')
screen:expect{grid=[[
## grid 1
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
{12:[No Name] [+] }|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
{12:[No Name] [+] }{11:[No Name] [+] }|
[3:-----------------------------------------------------]|
## grid 2
some text |
to be ^clicked |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
|
## grid 4
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmo |
{1:~ }|
## grid 5
some text |
to be clicked |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]]}
eq('clicked', funcs.getreg('"'))
funcs.setreg('"', '')
meths.input_mouse('left', 'press', '2', 4, 0, 64)
screen:expect{grid=[[
## grid 1
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
{11:[No Name] [+] }|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
{12:[No Name] [+] [No Name] [+] }|
[3:-----------------------------------------------------]|
## grid 2
some text |
to be clicked |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
{7:-- VISUAL --} |
## grid 4
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do {20:eiusm}^o |
{1:~ }|
## grid 5
some text |
to be clicked |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]]}
meths.input_mouse('right', 'press', '', 4, 0, 64)
meths.input_mouse('right', 'release', '', 4, 0, 64)
-- FIXME: popup menu position is strange
-- screen:expect{}
feed('<Down><CR>')
screen:expect{grid=[[
## grid 1
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
{11:[No Name] [+] }|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
{12:[No Name] [+] [No Name] [+] }|
[3:-----------------------------------------------------]|
## grid 2
some text |
to be clicked |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
|
## grid 4
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do ^eiusmo |
{1:~ }|
## grid 5
some text |
to be clicked |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
]]}
eq('eiusmo', funcs.getreg('"'))
command('wincmd J')
screen:try_resize_grid(4, 7, 10)
screen:expect{grid=[[
## grid 1
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
{12:[No Name] [+] [No Name] [+] }|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
{11:[No Name] [+] }|
[3:-----------------------------------------------------]|
## grid 2
some text |
to be clicked |
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
|
## grid 4
Lorem i|
psum do|
lor sit|
amet, |
consect|
etur ad|
ipiscin|
g elit,|
sed do|
^eiusmo|
## grid 5
some text |
to be clicked |
{1:~ }|
{1:~ }|
{1:~ }|
]]}
funcs.setreg('"', '')
meths.input_mouse('left', 'press', '2', 4, 9, 1)
screen:expect{grid=[[
## grid 1
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
{12:[No Name] [+] [No Name] [+] }|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
{11:[No Name] [+] }|
[3:-----------------------------------------------------]|
## grid 2
some text |
to be clicked |
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
{7:-- VISUAL --} |
## grid 4
Lorem i|
psum do|
lor sit|
amet, |
consect|
etur ad|
ipiscin|
g elit,|
sed do|
{20:eiusm}^o|
## grid 5
some text |
to be clicked |
{1:~ }|
{1:~ }|
{1:~ }|
]]}
meths.input_mouse('right', 'press', '', 4, 9, 1)
meths.input_mouse('right', 'release', '', 4, 9, 1)
screen:expect{grid=[[
## grid 1
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
{12:[No Name] [+] [No Name] [+] }|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
{11:[No Name] [+] }|
[3:-----------------------------------------------------]|
## grid 2
some text |
to be clicked |
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
{7:-- VISUAL --} |
## grid 4
Lorem i|
psum do|
lor sit|
amet, |
consect|
etur ad|
ipiscin|
g elit,|
sed do|
{20:eiusm}^o|
## grid 5
some text |
to be clicked |
{1:~ }|
{1:~ }|
{1:~ }|
## grid 6
{21: Copy }|
]], float_pos={
[6] = {{id = -1}, "SW", 4, 9, 0, false, 250};
}}
feed('<Down><CR>')
screen:expect{grid=[[
## grid 1
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
[5:------------------------------]│[2:----------------------]|
{12:[No Name] [+] [No Name] [+] }|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
[4:-----------------------------------------------------]|
{11:[No Name] [+] }|
[3:-----------------------------------------------------]|
## grid 2
some text |
to be clicked |
{1:~ }|
{1:~ }|
{1:~ }|
## grid 3
|
## grid 4
Lorem i|
psum do|
lor sit|
amet, |
consect|
etur ad|
ipiscin|
g elit,|
sed do|
^eiusmo|
## grid 5
some text |
to be clicked |
{1:~ }|
{1:~ }|
{1:~ }|
]]}
eq('eiusmo', funcs.getreg('"'))
end)
it('supports mouse drag with mouse=a', function()