From 706cbbff330a853e14caf89ba50fde3cd44ce534 Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Wed, 13 May 2026 13:46:30 +0200 Subject: [PATCH] fix(grid): keep grid sizes updated during redraw #39757 Problem: Assert tripped when window is resized during update_screen(). Solution: Re-allocate grid when resizing happens during update_screen(). --- src/nvim/window.c | 5 +++++ test/functional/ui/messages2_spec.lua | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/src/nvim/window.c b/src/nvim/window.c index 8a4cb6b733..43c1cf332a 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -7081,6 +7081,11 @@ void win_set_inner_size(win_T *wp, bool valid_cursor) } wp->w_redr_status = true; + + // Must keep grid dimensions updated during redraw. + if (updating_screen) { + win_grid_alloc(wp); + } } /// Set the width of a window. diff --git a/test/functional/ui/messages2_spec.lua b/test/functional/ui/messages2_spec.lua index 48a77d53df..3246f21465 100644 --- a/test/functional/ui/messages2_spec.lua +++ b/test/functional/ui/messages2_spec.lua @@ -1028,4 +1028,28 @@ describe('messages2', function() {1:~ }{4:hello}| ]]) end) + + it('no crash for resized grid during redraw #39075', function() + exec_lua(function() + vim.api.nvim_set_decoration_provider(vim.api.nvim_create_namespace(''), { + on_win = function() + print('\n') + end, + }) + end) + feed(':') + screen:expect([[ + | + {1:~ }|*12 + {16::}^ | + ]]) + feed('f') + screen:expect([[ + | + {1:~ }|*9 + {3: }| + |*2 + {16::}{15:f}^ | + ]]) + end) end)