Merge pull request #9730 from bfredl/pumfloat

compositor: fix rendering issues with floats opened after popupmenu
This commit is contained in:
Björn Linse 2019-03-14 12:22:46 +01:00 committed by GitHub
commit ced980ff17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 226 additions and 1 deletions

View File

@ -158,6 +158,7 @@ bool ui_comp_put_grid(ScreenGrid *grid, int row, int col, int height, int width,
if (insert_at < kv_size(layers)-1) {
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)->comp_index = i;
}
kv_A(layers, insert_at) = grid;
}

View File

@ -1477,9 +1477,233 @@ describe('floating windows', function()
]])
end
end)
end)
describe('float shown after pum', function()
local win
before_each(function()
command('hi NormalFloat guibg=#333333')
feed('i')
funcs.complete(1, {'aa', 'word', 'longtext'})
if multigrid then
screen:expect{grid=[[
## grid 1
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
{3:-- INSERT --} |
## grid 2
aa^ |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
## grid 3
{13:aa }|
{1:word }|
{1:longtext }|
]], float_pos={
[3] = {{id = -1}, "NW", 2, 1, 0, false}}
}
else
screen:expect([[
aa^ |
{13:aa }{0: }|
{1:word }{0: }|
{1:longtext }{0: }|
{0:~ }|
{0:~ }|
{3:-- INSERT --} |
]])
end
local buf = meths.create_buf(false,true)
meths.buf_set_lines(buf,0,-1,true,{"some info", "about item"})
win = meths.open_win(buf, false, 12, 2, {relative='cursor', row=1, col=10})
if multigrid then
screen:expect{grid=[[
## grid 1
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
{3:-- INSERT --} |
## grid 2
aa^ |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
## grid 3
{13:aa }|
{1:word }|
{1:longtext }|
## grid 5
{15:some info }|
{15:about item }|
]], float_pos={
[3] = {{id = -1}, "NW", 2, 1, 0, false},
[5] = {{id = 1002}, "NW", 2, 1, 12, true},
}}
else
screen:expect([[
aa^ |
{13:aa }{15:e info }{0: }|
{1:word }{15:ut item }{0: }|
{1:longtext }{0: }|
{0:~ }|
{0:~ }|
{3:-- INSERT --} |
]])
end
end)
it('and close pum first', function()
feed('<c-y>')
if multigrid then
screen:expect{grid=[[
## grid 1
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
{3:-- INSERT --} |
## grid 2
aa^ |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
## grid 5
{15:some info }|
{15:about item }|
]], float_pos={
[5] = {{id = 1002}, "NW", 2, 1, 12, true},
}}
else
screen:expect([[
aa^ |
{0:~ }{15:some info }{0: }|
{0:~ }{15:about item }{0: }|
{0:~ }|
{0:~ }|
{0:~ }|
{3:-- INSERT --} |
]])
end
meths.win_close(win, false)
if multigrid then
screen:expect([[
## grid 1
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
{3:-- INSERT --} |
## grid 2
aa^ |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
]])
else
screen:expect([[
aa^ |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{3:-- INSERT --} |
]])
end
end)
it('and close float first', function()
meths.win_close(win, false)
if multigrid then
screen:expect{grid=[[
## grid 1
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
{3:-- INSERT --} |
## grid 2
aa^ |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
## grid 3
{13:aa }|
{1:word }|
{1:longtext }|
]], float_pos={
[3] = {{id = -1}, "NW", 2, 1, 0, false},
}}
else
screen:expect([[
aa^ |
{13:aa }{0: }|
{1:word }{0: }|
{1:longtext }{0: }|
{0:~ }|
{0:~ }|
{3:-- INSERT --} |
]])
end
feed('<c-y>')
if multigrid then
screen:expect([[
## grid 1
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
{3:-- INSERT --} |
## grid 2
aa^ |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
]])
else
screen:expect([[
aa^ |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{3:-- INSERT --} |
]])
end
end)
end)
describe("handles :wincmd", function()
local win