feat(tui): open the /cost dialog when clicking the sidebar cost reading#3754
Merged
Conversation
docker-agent
left a comment
Contributor
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
The PR introduces ClickUsage hit-testing to the sidebar so clicking the token usage/cost reading opens the /cost dialog. The implementation is correct and the new tests provide good coverage across vertical mode, collapsed shared-line, collapsed own-line, hidden-usage, and the scrollbar regression.
The drafter found no high- or medium-severity issues. All observations were low-severity edge cases with negligible practical impact:
appendSectioncorrectly setsusageZoneStartto the index after gap lines (not including them), so gap-line clicks are not falsely attributed toClickUsage.- The scrollbar exclusion guard (
cachedNeedsScrollbar && adjustedX >= contentWidth) correctly relies on a priorView()call, which always precedes click processing in practice. - The collapsed shared-line usage check has no explicit right-bound column guard, but out-of-bounds clicks don't reach the sidebar handler in normal operation.
No changes requested.
gtardif
approved these changes
Jul 20, 2026
aheritier
added a commit
that referenced
this pull request
Jul 21, 2026
…3754 Clicking the token-usage / cost reading in the sidebar now opens the /cost dialog directly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The sidebar already displays token usage and estimated cost, but there was no way to click into the detail view — users had to know about the
/costcommand to see the breakdown. This makes the cost reading interactive, consistent with how other sidebar elements behave.Clicking the token usage/cost reading in the sidebar now opens the
/costdialog, the same dialog triggered by typing/costin the input. A newClickUsagehit-test result was added to the sidebar's hit-testing logic. The vertical Token Usage section records its line range while rendering, and the collapsed band correctly hit-tests the usage reading in both layouts: when it shares the working-directory row (right-aligned) and when it occupies its own row. The chat page maps the newTargetSidebarUsagetoShowCostDialogMsgon left-click.A follow-up fix ensures clicks on the sidebar scrollbar column and gap are never swallowed by the content click zones (usage, agents, title), so scrollbar-driven scrolling continues to work correctly. The fix also refreshes stale doc comments on
ClickResultvariants. New tests cover vertical mode, collapsed shared-line, collapsed own-line, hidden-usage, and the scrollbar regression.