aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/ui_compositor.c1
-rw-r--r--test/functional/ui/float_spec.lua226
2 files changed, 226 insertions, 1 deletions
diff --git a/src/nvim/ui_compositor.c b/src/nvim/ui_compositor.c
index 9ad3f851ad..50432dd119 100644
--- a/src/nvim/ui_compositor.c
+++ b/src/nvim/ui_compositor.c
@@ -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;
}
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
index 1113468d88..bb3255840e 100644
--- a/test/functional/ui/float_spec.lua
+++ b/test/functional/ui/float_spec.lua
@@ -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