Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion lua/fidget/notification/window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,17 @@ function M.get_window(row, col, anchor, relative, width, height)
height = math.min(height, M.options.max_height)
end

if state.window_id == nil or not vim.api.nvim_win_is_valid(state.window_id) then
local valid = state.window_id and vim.api.nvim_win_is_valid(state.window_id)

-- Window exists but is in a different tabpage; close it so we can recreate it in the correct tabpage.
-- Can avoid closing when https://github.com/neovim/neovim/pull/35816/files merged
if valid and vim.api.nvim_win_get_tabpage(state.window_id) ~= vim.api.nvim_get_current_tabpage() then
vim.api.nvim_win_close(state.window_id, true)
valid = false
state.window_id = nil
end

if not valid then
-- Create window to display notifications buffer, but don't enter (2nd param)
state.window_id = vim.api.nvim_open_win(M.get_buffer(), false, {
relative = relative,
Expand Down