mirror of
https://github.com/neovim/neovim.git
synced 2024-12-29 14:41:06 -07:00
fix(mouse): fix popup menu position check with winbar
This commit is contained in:
parent
a4bb8c37db
commit
e37fb2515d
@ -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_inner) { // In (or below) status line
|
||||
if (winrow >= wp->w_height_inner) { // In (or below) status line
|
||||
return IN_STATUS_LINE;
|
||||
}
|
||||
|
||||
|
@ -1861,5 +1861,16 @@ describe('ui/mouse/input', function()
|
||||
feed('<Down><CR>')
|
||||
eq({1, 9}, meths.win_get_cursor(0))
|
||||
eq('ran away', funcs.getreg('"'))
|
||||
|
||||
-- Test for right click inside visual selection at bottom of window with winbar
|
||||
command('setlocal winbar=WINBAR')
|
||||
feed('2yyP')
|
||||
funcs.setreg('"', '')
|
||||
feed('G$vbb')
|
||||
meths.input_mouse('right', 'press', '', 0, 4, 61)
|
||||
meths.input_mouse('right', 'release', '', 0, 4, 61)
|
||||
feed('<Down><CR>')
|
||||
eq({4, 20}, meths.win_get_cursor(0))
|
||||
eq('the moon', funcs.getreg('"'))
|
||||
end)
|
||||
end)
|
||||
|
@ -4509,6 +4509,79 @@ describe('builtin popupmenu', function()
|
||||
]])
|
||||
end
|
||||
eq('foo', meths.get_var('menustr'))
|
||||
|
||||
command('setlocal winbar=WINBAR')
|
||||
if multigrid then
|
||||
meths.input_mouse('right', 'press', '', 6, 1, 14)
|
||||
screen:expect({grid=[[
|
||||
## grid 1
|
||||
[2:--------------------------------]|
|
||||
[2:--------------------------------]|
|
||||
{3:[No Name] [+] }|
|
||||
[5:---------------]│[6:----------------]|
|
||||
[5:---------------]│[6:----------------]|
|
||||
[3:--------------------------------]|
|
||||
## grid 2
|
||||
popup menu test |
|
||||
{1:~ }|
|
||||
## grid 3
|
||||
:let g:menustr = 'foo' |
|
||||
## grid 4
|
||||
{n: foo}|
|
||||
{n: bar}|
|
||||
{n: baz}|
|
||||
## grid 5
|
||||
popup menu test|
|
||||
{1:~ }|
|
||||
## grid 6
|
||||
{2:WINBAR }|
|
||||
^popup menu test |
|
||||
]], float_pos={[4] = {{id = -1}, "SW", 6, 1, 12, false, 250}}})
|
||||
else
|
||||
feed('<RightMouse><30,4>')
|
||||
screen:expect([[
|
||||
popup menu test |
|
||||
{1:~ }{n: foo}|
|
||||
{3:[No Name] [+] }{n: bar}|
|
||||
popup menu test│{2:WINBAR }{n: baz}|
|
||||
{1:~ }│^popup menu test |
|
||||
:let g:menustr = 'foo' |
|
||||
]])
|
||||
end
|
||||
if multigrid then
|
||||
meths.input_mouse('left', 'press', '', 4, 1, 2)
|
||||
screen:expect({grid=[[
|
||||
## grid 1
|
||||
[2:--------------------------------]|
|
||||
[2:--------------------------------]|
|
||||
{3:[No Name] [+] }|
|
||||
[5:---------------]│[6:----------------]|
|
||||
[5:---------------]│[6:----------------]|
|
||||
[3:--------------------------------]|
|
||||
## grid 2
|
||||
popup menu test |
|
||||
{1:~ }|
|
||||
## grid 3
|
||||
:let g:menustr = 'bar' |
|
||||
## grid 5
|
||||
popup menu test|
|
||||
{1:~ }|
|
||||
## grid 6
|
||||
{2:WINBAR }|
|
||||
^popup menu test |
|
||||
]]})
|
||||
else
|
||||
feed('<LeftMouse><31,2>')
|
||||
screen:expect([[
|
||||
popup menu test |
|
||||
{1:~ }|
|
||||
{3:[No Name] [+] }|
|
||||
popup menu test│{2:WINBAR }|
|
||||
{1:~ }│^popup menu test |
|
||||
:let g:menustr = 'bar' |
|
||||
]])
|
||||
end
|
||||
eq('bar', meths.get_var('menustr'))
|
||||
end)
|
||||
|
||||
if not multigrid then
|
||||
|
Loading…
Reference in New Issue
Block a user