Skip to content
Permalink
Browse files

Merge pull request #9730 from bfredl/pumfloat

compositor: fix rendering issues with floats opened after popupmenu
  • Loading branch information...
bfredl committed Mar 14, 2019
2 parents cbe4377 + ca5f919 commit ced980ff17e18267e3d7a55fc1c513d967790e5e
Showing with 226 additions and 1 deletion.
  1. +1 −0 src/nvim/ui_compositor.c
  2. +225 −1 test/functional/ui/float_spec.lua
@@ -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;
}
@@ -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

0 comments on commit ced980f

Please sign in to comment.
You can’t perform that action at this time.