Skip to content

Commit 09e4ca4

Browse files
committed
fix(topbar): make sure it's always set
It's important to make sure the topbar is always initialized, otherwise the footer will be off by one Would be nice to find a cleaner way to do the topbar/footer setup
1 parent d3d971e commit 09e4ca4

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

lua/opencode/ui/topbar.lua

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,17 @@ function M.render()
9494
if not win then
9595
return
9696
end
97-
vim.wo[win].winbar =
98-
create_winbar_text(get_session_desc(), format_model_info(), format_mode_info(), vim.api.nvim_win_get_width(win))
97+
98+
-- we need the topbar to always initialize to make sure footer is positioned
99+
-- these can fail in the replay runner so wrap them
100+
local ok, model_info = pcall(format_model_info)
101+
model_info = ok and model_info or ''
102+
103+
local mode_info
104+
ok, mode_info = pcall(format_mode_info)
105+
mode_info = ok and mode_info or ''
106+
107+
vim.wo[win].winbar = create_winbar_text(get_session_desc(), model_info, mode_info, vim.api.nvim_win_get_width(win))
99108

100109
update_winbar_highlights(win)
101110
end)

0 commit comments

Comments
 (0)