fix(float): changing zindex does not restack drawn float #42571

Problem:
nvim_win_set_config() with only a new zindex does not change which
float is drawn on top.

Solution:
Recompose the grid area after its layer is reordered.
This commit is contained in:
glepnir authored and GitHub committed 2026-10-30 09:21:56 -04:00
1 parent cdc0355ebc
commit bf4b0ea764
2 files changed
+47

No files matched your search

+3
View File
@@ -957,6 +957,9 @@ void ui_ext_win_position(win_T *wp, bool validate)
if (!c.hide) {
ui_comp_put_grid(&wp->w_grid_alloc, comp_row, comp_col,
wp->w_height_outer, wp->w_width_outer, valid, false);
if (resort) {
ui_comp_compose_grid(&wp->w_grid_alloc);
}
if (ui_has(kUIMultigrid)) {
String anchor = cstr_as_string(float_anchor_str[c.anchor]);
ui_call_win_float_pos(wp->w_grid_alloc.handle, wp->handle, anchor,
+44
View File
@@ -10016,6 +10016,50 @@ describe('float window', function()
}
end
-- changing only zindex restacks the float #42556
api.nvim_win_set_config(win1, { zindex = 60 })
if multigrid then
screen:expect {
grid = [[
## grid 1
[2:----------------------------------------]|*6
[3:----------------------------------------]|
## grid 2
^ |
{0:~ }|*5
## grid 3
|
## grid 4
{7: }|
{7:~ }|*2
## grid 5
{17: }|
{17:~ }|*2
## grid 6
{8: }|
{8:~ }|*2
]],
float_pos = {
[4] = { 1001, 'NW', 1, 1, 5, true, 60, 3, 1, 5 },
[5] = { 1002, 'NW', 1, 2, 6, true, 50, 2, 2, 6 },
[6] = { 1003, 'NW', 1, 3, 7, true, 40, 1, 3, 7 },
},
}
else
screen:expect {
grid = [[
^ |
{0:~ }{7: }{0: }|
{0:~ }{7:~ }{17: }{0: }|
{0:~ }{7:~ }{17: }{8: }{0: }|
{0:~ }{17:~ }{8: }{0: }|
{0:~ }{8:~ }{0: }|
|
]],
}
end
api.nvim_win_set_config(win1, { zindex = 30 })
--
-- Check that floats are positioned correctly after changing the zindexes.
--