aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-04-24 09:26:10 +0800
committerGitHub <noreply@github.com>2023-04-24 09:26:10 +0800
commitc1331a65dd12dd1128db5fb136a77218ef7376f1 (patch)
tree0e2b32ab6d02ea1d6a91e3c0385e3a4a8606a875
parent664f2749e688e2aa2b322d2296111e1246a860ee (diff)
downloadrneovim-c1331a65dd12dd1128db5fb136a77218ef7376f1.tar.gz
rneovim-c1331a65dd12dd1128db5fb136a77218ef7376f1.tar.bz2
rneovim-c1331a65dd12dd1128db5fb136a77218ef7376f1.zip
fix(pum): show right-click menu above cmdline area (#23298)
-rw-r--r--src/nvim/popupmenu.c5
-rw-r--r--test/functional/ui/popupmenu_spec.lua18
2 files changed, 11 insertions, 12 deletions
diff --git a/src/nvim/popupmenu.c b/src/nvim/popupmenu.c
index 334a9bc904..9be005622b 100644
--- a/src/nvim/popupmenu.c
+++ b/src/nvim/popupmenu.c
@@ -399,6 +399,7 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed, i
// room the window size will keep changing.
} while (pum_set_selected(selected, redo_count) && (++redo_count <= 2));
+ pum_grid.zindex = (State == MODE_CMDLINE) ? kZIndexCmdlinePopupMenu : kZIndexPopupMenu;
pum_redraw();
}
@@ -443,9 +444,6 @@ void pum_redraw(void)
grid_assign_handle(&pum_grid);
- pum_grid.zindex = ((State == MODE_CMDLINE)
- ? kZIndexCmdlinePopupMenu : kZIndexPopupMenu);
-
bool moved = ui_comp_put_grid(&pum_grid, pum_row, pum_col - col_off,
pum_height, grid_width, false, true);
bool invalid_grid = moved || pum_invalid;
@@ -1088,6 +1086,7 @@ void pum_show_popupmenu(vimmenu_T *menu)
for (;;) {
pum_is_visible = true;
pum_is_drawn = true;
+ pum_grid.zindex = kZIndexCmdlinePopupMenu; // show above cmdline area #23275
pum_redraw();
setcursor_mayforce(true);
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua
index cfcf83ba42..53ef60bc89 100644
--- a/test/functional/ui/popupmenu_spec.lua
+++ b/test/functional/ui/popupmenu_spec.lua
@@ -3259,16 +3259,16 @@ describe('builtin popupmenu', function()
:let g:menustr = 'bar' |
]])
eq('bar', meths.get_var('menustr'))
- feed('<RightMouse><20,1>')
+ feed('<RightMouse><20,2>')
screen:expect([[
^popup menu test |
{1:~ }|
+ {1:~ }|
{1:~ }{n: foo }{1: }|
{1:~ }{n: bar }{1: }|
- {1:~ }{n: baz }{1: }|
- :let g:menustr = 'bar' |
+ :let g:menustr = 'b{n: baz } |
]])
- feed('<LeftMouse><22,4>')
+ feed('<LeftMouse><22,5>')
screen:expect([[
^popup menu test |
{1:~ }|
@@ -3675,7 +3675,7 @@ describe('builtin popupmenu with ui/ext_multigrid', function()
{n: foo }|
{n: bar }|
{n: baz }|
- ]], float_pos={[4] = {{id = -1}, 'NW', 2, 2, 19, false, 100}}})
+ ]], float_pos={[4] = {{id = -1}, 'NW', 2, 2, 19, false, 250}}})
meths.input_mouse('left', 'press', '', 4, 2, 2)
screen:expect({grid=[[
## grid 1
@@ -3716,7 +3716,7 @@ describe('builtin popupmenu with ui/ext_multigrid', function()
{n: foo }|
{n: bar }|
{n: baz }|
- ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 3, false, 100}}})
+ ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 3, false, 250}}})
meths.input_mouse('right', 'drag', '', 2, 3, 6)
screen:expect({grid=[[
## grid 1
@@ -3738,7 +3738,7 @@ describe('builtin popupmenu with ui/ext_multigrid', function()
{n: foo }|
{n: bar }|
{s: baz }|
- ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 3, false, 100}}})
+ ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 3, false, 250}}})
meths.input_mouse('right', 'release', '', 2, 1, 6)
screen:expect({grid=[[
## grid 1
@@ -3780,7 +3780,7 @@ describe('builtin popupmenu with ui/ext_multigrid', function()
{n: foo }|
{n: bar }|
{n: baz }|
- ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 3, false, 100}}})
+ ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 3, false, 250}}})
eq(true, screen.options.mousemoveevent)
meths.input_mouse('move', '', '', 2, 3, 6)
screen:expect({grid=[[
@@ -3803,7 +3803,7 @@ describe('builtin popupmenu with ui/ext_multigrid', function()
{n: foo }|
{n: bar }|
{s: baz }|
- ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 3, false, 100}}})
+ ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 3, false, 250}}})
eq(true, screen.options.mousemoveevent)
meths.input_mouse('left', 'press', '', 2, 2, 6)
screen:expect({grid=[[