Skip to content

Commit

Permalink
fix(nui): make sure nui recreates buffer and window when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jan 16, 2023
1 parent 3d4b80d commit 3e6dfd8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lua/noice/view/nui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,15 @@ function NuiView:update_layout()
end

function NuiView:is_mounted()
return self._nui and self._nui._.mounted and self._nui.bufnr and vim.api.nvim_buf_is_valid(self._nui.bufnr)
if self._nui and self._nui.bufnr and not vim.api.nvim_buf_is_valid(self._nui.bufnr) then
self._nui.bufnr = nil
end

if self._nui and self._nui.winid and not vim.api.nvim_win_is_valid(self._nui.winid) then
self._nui.winid = nil
end

return self._nui and self._nui._.mounted and self._nui.bufnr
end

function NuiView:show()
Expand Down

0 comments on commit 3e6dfd8

Please sign in to comment.