Merge pull request #14137 from last-partizan/patch-1-test

Fix popupmenu position in multigrid mode (pum_above)
This commit is contained in:
Björn Linse
2021-06-12 14:59:47 +02:00
committed by GitHub
2 changed files with 48 additions and 1 deletions

View File

@@ -440,7 +440,7 @@ void pum_redraw(void)
} }
if (ui_has(kUIMultigrid)) { if (ui_has(kUIMultigrid)) {
const char *anchor = pum_above ? "SW" : "NW"; const char *anchor = pum_above ? "SW" : "NW";
int row_off = pum_above ? pum_height : 0; int row_off = pum_above ? -pum_height : 0;
ui_call_win_float_pos(pum_grid.handle, -1, cstr_to_string(anchor), ui_call_win_float_pos(pum_grid.handle, -1, cstr_to_string(anchor),
pum_anchor_grid, pum_row-row_off, pum_col-col_off, pum_anchor_grid, pum_row-row_off, pum_col-col_off,
false, pum_grid.zindex); false, pum_grid.zindex);

View File

@@ -2901,6 +2901,53 @@ describe('float window', function()
end end
end) end)
it('command menu rendered above cursor (pum_above)', function()
command('set wildmenu wildmode=longest:full wildoptions=pum')
feed(':sign u<tab>')
if multigrid then
screen:expect{grid=[[
## grid 1
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[3:----------------------------------------]|
## grid 2
|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
## grid 3
:sign un^ |
## grid 4
{7: }|
{12:~ }|
{12:~ }|
{12:~ }|
## grid 5
{1: undefine }|
{1: unplace }|
]], float_pos={
[5] = {{id = -1}, "SW", 1, 6, 5, false, 250};
[4] = {{id = 1001}, "NW", 1, 2, 5, true, 50};
}}
else
screen:expect{grid=[[
|
{0:~ }|
{0:~ }{7: }{0: }|
{0:~ }{12:~ }{0: }|
{0:~ }{1: undefine }{0: }|
{0:~ }{1: unplace }{0: }|
:sign un^ |
]]}
end
end)
it('with ext_popupmenu', function() it('with ext_popupmenu', function()
screen:set_option('ext_popupmenu', true) screen:set_option('ext_popupmenu', true)
feed('ix ') feed('ix ')