diff options
| author | neovim-backports[bot] <175700243+neovim-backports[bot]@users.noreply.github.com> | 2026-04-22 13:43:04 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-22 13:43:04 +0000 |
| commit | b6a3ad3979cc187fe59d57091c0434a7d3a937c1 (patch) | |
| tree | 6dee3bca0c7b3ec7146cf088907dac606c60e166 | |
| parent | 6ae6cf5d61979e2f04dda14ba249ecbe21999faf (diff) | |
backport: fix(ui2): ensure msg window is visible after closing tab (#39245)
fix(ui2): ensure msg window is visible after closing tab
Problem: After closing a tabpage while the msg window is showing a
message, it is hidden while the msg window still contains a
message.
Solution: Unhide the msg window after entering a tabpage and it still
contains a message.
(cherry picked from commit 607fcfb37acd78b0e26c35acb463093957d94c45)
Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
Co-authored-by: Linykq <yukunlin590@gmail.com>
| -rw-r--r-- | runtime/lua/vim/_core/ui2.lua | 6 | ||||
| -rw-r--r-- | test/functional/ui/messages2_spec.lua | 18 |
2 files changed, 23 insertions, 1 deletions
diff --git a/runtime/lua/vim/_core/ui2.lua b/runtime/lua/vim/_core/ui2.lua index 58b2331cd3..14211e333e 100644 --- a/runtime/lua/vim/_core/ui2.lua +++ b/runtime/lua/vim/_core/ui2.lua @@ -237,8 +237,12 @@ function M.enable(opts) api.nvim_create_autocmd({ 'VimResized', 'TabEnter' }, { group = M.augroup, - callback = function() + callback = function(ev) M.check_targets() + -- After a tabpage was closed unhide the msg window on the current tabpage. + if ev.event == 'TabEnter' and next(M.msg.msg.ids) ~= nil then + api.nvim_win_set_config(M.wins.msg, { hide = false, width = M.msg.msg.width }) + end M.msg.set_pos() end, desc = 'Set cmdline and message window dimensions after shell resize or tabpage change.', diff --git a/test/functional/ui/messages2_spec.lua b/test/functional/ui/messages2_spec.lua index 7a1afc2cfd..0c3ebb1937 100644 --- a/test/functional/ui/messages2_spec.lua +++ b/test/functional/ui/messages2_spec.lua @@ -977,4 +977,22 @@ describe('messages2', function() foo | ]]) end) + + it('message survives after closing tabpage without error #39055', function() + set_msg_target_zero_ch() + command('tabnew') + command('echo "hello"') + screen:expect([[ + {24: [No Name] }{5: [No Name] }{2: }{24:X}| + ^ | + {1:~ }|*11 + {1:~ }{4:hello}| + ]]) + command('quit!') + screen:expect([[ + ^ | + {1:~ }|*12 + {1:~ }{4:hello}| + ]]) + end) end) |
