Skip to content

Commit 835acb0

Browse files
committed
fix(footer): reset token counting when changing session
1 parent 94a71c5 commit 835acb0

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

lua/opencode/ui/footer.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ function M.setup(windows)
9090

9191
-- for stats changes
9292
state.subscribe('current_model', on_change)
93+
state.subscribe('active_session', on_change)
9394
-- to show C-c message
9495
state.subscribe('job_count', on_job_count_changed)
9596
state.subscribe('restore_points', on_change)

lua/opencode/ui/renderer.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,10 @@ function M._setup_event_subscriptions(subscribe)
100100

101101
if subscribe then
102102
state.subscribe('is_opencode_focused', M.on_focus_changed)
103+
state.subscribe('active_session', M.on_session_changed)
103104
else
104105
state.unsubscribe('is_opencode_focused', M.on_focus_changed)
106+
state.unsubscribe('active_session', M.on_session_changed)
105107
end
106108
end
107109

@@ -968,6 +970,10 @@ function M.on_focus_changed()
968970
end
969971
end
970972

973+
function M.on_session_changed()
974+
state.tokens_count = 0
975+
end
976+
971977
---Get all actions available at a specific line
972978
---@param line integer 1-indexed line number
973979
---@return table[] List of actions available at that line

0 commit comments

Comments
 (0)