mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 20:55:18 -07:00
fix(mouse): fix popup_setpos position check with ext_multigrid (#23436)
This commit is contained in:
parent
86c9d8b53c
commit
7c1921e9d6
@ -223,7 +223,7 @@ static int get_fpos_of_mouse(pos_T *mpos)
|
||||
}
|
||||
|
||||
// winpos and height may change in win_enter()!
|
||||
if (winrow + wp->w_winbar_height >= wp->w_height) { // In (or below) status line
|
||||
if (winrow + wp->w_winbar_height >= wp->w_height_inner) { // In (or below) status line
|
||||
return IN_STATUS_LINE;
|
||||
}
|
||||
|
||||
@ -231,7 +231,7 @@ static int get_fpos_of_mouse(pos_T *mpos)
|
||||
return MOUSE_WINBAR;
|
||||
}
|
||||
|
||||
if (wincol >= wp->w_width) { // In vertical separator line
|
||||
if (wincol >= wp->w_width_inner) { // In vertical separator line
|
||||
return IN_SEP_LINE;
|
||||
}
|
||||
|
||||
@ -557,10 +557,7 @@ bool do_mouse(oparg_T *oap, int c, int dir, long count, bool fixindent)
|
||||
if (VIsual_active) {
|
||||
// set MOUSE_MAY_STOP_VIS if we are outside the selection
|
||||
// or the current window (might have false negative here)
|
||||
if (mouse_row < curwin->w_winrow
|
||||
|| mouse_row > (curwin->w_winrow + curwin->w_height)) {
|
||||
jump_flags = MOUSE_MAY_STOP_VIS;
|
||||
} else if (m_pos_flag != IN_BUFFER) {
|
||||
if (m_pos_flag != IN_BUFFER) {
|
||||
jump_flags = MOUSE_MAY_STOP_VIS;
|
||||
} else {
|
||||
if (VIsual_mode == 'V') {
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user