neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 66e4784f5acef73ede2b1182b2e6d5a99f44f64a
parent 5f00e6adafebc7764c64496540bdd703e8a6a24e
Author: luukvbaal <luukvbaal@gmail.com>
Date:   Thu, 12 Jun 2025 08:51:29 +0200

fix(float): ensure relative window grid is allocated (#34459)

Problem:  Uninitialized grid for a "win" relative float when redrawing
          just after it has been opened.
Solution: Ensure window grid is allocated or assigned the default grid.
Diffstat:
Msrc/nvim/window.c | 1+
Mtest/functional/ui/float_spec.lua | 14++++++++++++++
2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/nvim/window.c b/src/nvim/window.c @@ -844,6 +844,7 @@ void ui_ext_win_position(win_T *wp, bool validate) } int row_off = 0; int col_off = 0; + win_grid_alloc(win); grid = grid_adjust(&win->w_grid, &row_off, &col_off); row += row_off; col += col_off; diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua @@ -909,6 +909,20 @@ describe('float window', function() eq({ 3, 3 }, { fn.winnr(), fn.win_id2win(win) }) end) + it('no crash for unallocated relative window grid', function() + local win = api.nvim_open_win(0, false, { relative = 'editor', row = 0, col = 0, height = 1, width = 1 }) + exec_lua(function() + vim.api.nvim_create_autocmd('CmdwinEnter', { + callback = function() + vim.api.nvim_win_set_config(win, { relative = 'win', win = 0, row = 0, col = 0 }) + vim.api.nvim__redraw({ flush = true }) + end, + }) + end) + feed('q:') + assert_alive() + end) + local function with_ext_multigrid(multigrid) local screen, attrs before_each(function()