mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
floats: handle interaction with popupmenu and border correctly
This commit is contained in:
parent
1186f7dd96
commit
3000f6c56b
@ -140,7 +140,9 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed,
|
|||||||
}
|
}
|
||||||
|
|
||||||
pum_anchor_grid = (int)curwin->w_grid.target->handle;
|
pum_anchor_grid = (int)curwin->w_grid.target->handle;
|
||||||
if (!ui_has(kUIMultigrid)) {
|
pum_win_row += curwin->w_grid.row_offset;
|
||||||
|
cursor_col += curwin->w_grid.col_offset;
|
||||||
|
if (!ui_has(kUIMultigrid) && curwin->w_grid.target != &default_grid) {
|
||||||
pum_anchor_grid = (int)default_grid.handle;
|
pum_anchor_grid = (int)default_grid.handle;
|
||||||
pum_win_row += curwin->w_winrow;
|
pum_win_row += curwin->w_winrow;
|
||||||
cursor_col += curwin->w_wincol;
|
cursor_col += curwin->w_wincol;
|
||||||
|
@ -184,14 +184,12 @@ bool ui_comp_put_grid(ScreenGrid *grid, int row, int col, int height, int width,
|
|||||||
insert_at--;
|
insert_at--;
|
||||||
}
|
}
|
||||||
// not found: new grid
|
// not found: new grid
|
||||||
kv_push(layers, grid);
|
kv_pushp(layers);
|
||||||
if (insert_at < kv_size(layers)-1) {
|
|
||||||
for (size_t i = kv_size(layers)-1; i > insert_at; i--) {
|
for (size_t i = kv_size(layers)-1; i > insert_at; i--) {
|
||||||
kv_A(layers, i) = kv_A(layers, i-1);
|
kv_A(layers, i) = kv_A(layers, i-1);
|
||||||
kv_A(layers, i)->comp_index = i;
|
kv_A(layers, i)->comp_index = i;
|
||||||
}
|
}
|
||||||
kv_A(layers, insert_at) = grid;
|
kv_A(layers, insert_at) = grid;
|
||||||
}
|
|
||||||
|
|
||||||
grid->comp_row = row;
|
grid->comp_row = row;
|
||||||
grid->comp_col = col;
|
grid->comp_col = col;
|
||||||
@ -280,6 +278,9 @@ static void ui_comp_grid_cursor_goto(UI *ui, Integer grid_handle,
|
|||||||
// should configure all grids before entering win_update()
|
// should configure all grids before entering win_update()
|
||||||
if (curgrid != &default_grid) {
|
if (curgrid != &default_grid) {
|
||||||
size_t new_index = kv_size(layers)-1;
|
size_t new_index = kv_size(layers)-1;
|
||||||
|
if (kv_A(layers, new_index) == &msg_grid) {
|
||||||
|
new_index--;
|
||||||
|
}
|
||||||
if (kv_A(layers, new_index) == &pum_grid) {
|
if (kv_A(layers, new_index) == &pum_grid) {
|
||||||
new_index--;
|
new_index--;
|
||||||
}
|
}
|
||||||
|
@ -774,6 +774,131 @@ describe('float window', function()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('with border show popupmenu', function()
|
||||||
|
screen:try_resize(40,10)
|
||||||
|
local buf = meths.create_buf(false, false)
|
||||||
|
meths.buf_set_lines(buf, 0, -1, true, {'aaa aab ',
|
||||||
|
'abb acc ', ''})
|
||||||
|
meths.open_win(buf, true, {relative='editor', width=9, height=3, row=0, col=5, border="double"})
|
||||||
|
feed 'G'
|
||||||
|
|
||||||
|
if multigrid then
|
||||||
|
screen:expect{grid=[[
|
||||||
|
## grid 1
|
||||||
|
[2:----------------------------------------]|
|
||||||
|
[2:----------------------------------------]|
|
||||||
|
[2:----------------------------------------]|
|
||||||
|
[2:----------------------------------------]|
|
||||||
|
[2:----------------------------------------]|
|
||||||
|
[2:----------------------------------------]|
|
||||||
|
[2:----------------------------------------]|
|
||||||
|
[2:----------------------------------------]|
|
||||||
|
[2:----------------------------------------]|
|
||||||
|
[3:----------------------------------------]|
|
||||||
|
## grid 2
|
||||||
|
|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
## grid 3
|
||||||
|
|
|
||||||
|
## grid 5
|
||||||
|
{5:╔═════════╗}|
|
||||||
|
{5:║}{1:aaa aab }{5:║}|
|
||||||
|
{5:║}{1:abb acc }{5:║}|
|
||||||
|
{5:║}{1:^ }{5:║}|
|
||||||
|
{5:╚═════════╝}|
|
||||||
|
]], float_pos={
|
||||||
|
[5] = { { id = 1002 }, "NW", 1, 0, 5, true }
|
||||||
|
}, win_viewport={
|
||||||
|
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||||
|
[5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 0};
|
||||||
|
}}
|
||||||
|
else
|
||||||
|
screen:expect{grid=[[
|
||||||
|
{5:╔═════════╗} |
|
||||||
|
{0:~ }{5:║}{1:aaa aab }{5:║}{0: }|
|
||||||
|
{0:~ }{5:║}{1:abb acc }{5:║}{0: }|
|
||||||
|
{0:~ }{5:║}{1:^ }{5:║}{0: }|
|
||||||
|
{0:~ }{5:╚═════════╝}{0: }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
|
|
||||||
|
]]}
|
||||||
|
end
|
||||||
|
|
||||||
|
feed 'i<c-x><c-p>'
|
||||||
|
|
||||||
|
if multigrid then
|
||||||
|
screen:expect{grid=[[
|
||||||
|
## grid 1
|
||||||
|
[2:----------------------------------------]|
|
||||||
|
[2:----------------------------------------]|
|
||||||
|
[2:----------------------------------------]|
|
||||||
|
[2:----------------------------------------]|
|
||||||
|
[2:----------------------------------------]|
|
||||||
|
[2:----------------------------------------]|
|
||||||
|
[2:----------------------------------------]|
|
||||||
|
[2:----------------------------------------]|
|
||||||
|
[2:----------------------------------------]|
|
||||||
|
[3:----------------------------------------]|
|
||||||
|
## grid 2
|
||||||
|
|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
## grid 3
|
||||||
|
{3:-- }{8:match 1 of 4} |
|
||||||
|
## grid 5
|
||||||
|
{5:╔═════════╗}|
|
||||||
|
{5:║}{1:aaa aab }{5:║}|
|
||||||
|
{5:║}{1:abb acc }{5:║}|
|
||||||
|
{5:║}{1:acc^ }{5:║}|
|
||||||
|
{5:╚═════════╝}|
|
||||||
|
## grid 6
|
||||||
|
{1: aaa }|
|
||||||
|
{1: aab }|
|
||||||
|
{1: abb }|
|
||||||
|
{13: acc }|
|
||||||
|
]], float_pos={
|
||||||
|
[5] = { {
|
||||||
|
id = 1002
|
||||||
|
}, "NW", 1, 0, 5, true },
|
||||||
|
[6] = { {
|
||||||
|
id = -1
|
||||||
|
}, "NW", 5, 4, 0, false }
|
||||||
|
}, win_viewport={
|
||||||
|
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||||
|
[5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 3};
|
||||||
|
}}
|
||||||
|
else
|
||||||
|
screen:expect{grid=[[
|
||||||
|
{5:╔═════════╗} |
|
||||||
|
{0:~ }{5:║}{1:aaa aab }{5:║}{0: }|
|
||||||
|
{0:~ }{5:║}{1:abb acc }{5:║}{0: }|
|
||||||
|
{0:~ }{5:║}{1:acc^ }{5:║}{0: }|
|
||||||
|
{0:~ }{1: aaa }{0: }|
|
||||||
|
{0:~ }{1: aab }{0: }|
|
||||||
|
{0:~ }{1: abb }{0: }|
|
||||||
|
{0:~ }{13: acc }{0: }|
|
||||||
|
{0:~ }|
|
||||||
|
{3:-- }{8:match 1 of 4} |
|
||||||
|
]]}
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
it('can have minimum size', function()
|
it('can have minimum size', function()
|
||||||
insert("the background text")
|
insert("the background text")
|
||||||
local buf = meths.create_buf(false, true)
|
local buf = meths.create_buf(false, true)
|
||||||
|
Loading…
Reference in New Issue
Block a user