Skip to content

Commit ba487c5

Browse files
cameronrsudo-tee
authored andcommitted
fix(footer): wasn't closing when closing UI
Happened because other parts of the UI had already gone away so M.mounted() was returning false. Go back to just checking state.windows Fixes #103
1 parent aad6305 commit ba487c5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lua/opencode/ui/footer.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ function M.setup(windows)
9898
end
9999

100100
function M.close()
101-
if M.mounted() then
102-
---@cast state.windows { footer_win: integer, footer_buf: integer }
103-
104-
pcall(vim.api.nvim_win_close, state.windows.footer_win, true)
105-
pcall(vim.api.nvim_buf_delete, state.windows.footer_buf, { force = true })
101+
local windows = state.windows
102+
if windows then
103+
---@cast windows {footer_win: integer, footer_buf: integer}
104+
pcall(vim.api.nvim_win_close, windows.footer_win, true)
105+
pcall(vim.api.nvim_buf_delete, windows.footer_buf, { force = true })
106106
end
107107

108108
state.unsubscribe('current_model', on_change)
@@ -113,7 +113,7 @@ function M.close()
113113
end
114114

115115
function M.mounted(windows)
116-
windows = state.windows
116+
windows = windows or state.windows
117117
return windows
118118
and windows.footer_win
119119
and vim.api.nvim_win_is_valid(windows.footer_win)

0 commit comments

Comments
 (0)