aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-05-03 10:29:19 +0800
committerGitHub <noreply@github.com>2023-05-03 10:29:19 +0800
commitdc394b9641f92a5014147da58f5e14fd1681ec0f (patch)
tree76812ab57c590341d9ce8a960d87e4af1f86ca83 /test
parenta4bb8c37dbe9233662e0adaf7ad34fb4f094d114 (diff)
downloadrneovim-dc394b9641f92a5014147da58f5e14fd1681ec0f.tar.gz
rneovim-dc394b9641f92a5014147da58f5e14fd1681ec0f.tar.bz2
rneovim-dc394b9641f92a5014147da58f5e14fd1681ec0f.zip
fix(mouse): fix popup menu position check with winbar (#23456)
Diffstat (limited to 'test')
-rw-r--r--test/functional/ui/mouse_spec.lua11
-rw-r--r--test/functional/ui/popupmenu_spec.lua73
2 files changed, 84 insertions, 0 deletions
diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua
index d9b9cf9f1b..2c0a00c74f 100644
--- a/test/functional/ui/mouse_spec.lua
+++ b/test/functional/ui/mouse_spec.lua
@@ -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)
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua
index 61b815dbf6..76038472bd 100644
--- a/test/functional/ui/popupmenu_spec.lua
+++ b/test/functional/ui/popupmenu_spec.lua
@@ -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