fix(cli): align box borders in gain, cheatsheet and config show - #1094
Closed
andig wants to merge 1 commit into
Closed
fix(cli): align box borders in gain, cheatsheet and config show#1094andig wants to merge 1 commit into
andig wants to merge 1 commit into
Conversation
Three box renderers padded rows with hardcoded runs of spaces instead of the width-aware theme::pad_right helper, so any variable-length or ANSI-coloured content pushed the right border out of line. - gain: weekly-nudge card rows drifted with the token count - cheatsheet: header row was 1 column short and grew with the version - config show: rows had no right border at all; top/bottom differed by 1-3 columns between the two frames All three now pad to a named interior width via theme::pad_right.
yvgude
approved these changes
Jul 21, 2026
yvgude
left a comment
Owner
There was a problem hiding this comment.
Code Review: fix(cli): align box borders
Clean, well-structured fix.
What it does:
- Extracts
box_top(),box_bottom(),box_row()helpers with constantSHOW_BOX_W = 60 - Fixes cheatsheet header: uses
{ver_pad:>29}for version alignment instead of hardcoded spaces - Fixes config show: dynamic width via
pad_right()ensures right border aligns regardless of value length - Fixes dashboard gain hero "first week" box:
nudge_line()closure handles variable token counts
Quality:
show_box_borders_line_uptest verifies visual alignment for multiple labels, short and overlong content- Uses existing
theme::visual_len()andtheme::pad_right()for ANSI-aware width calculation - No hardcoded column arithmetic that could drift
LGTM.
yvgude
added a commit
that referenced
this pull request
Jul 21, 2026
Owner
|
Merged to main via CLI rebase+merge (part of batch merge session). |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Several CLI dashboards draw framed boxes by padding rows with a hardcoded run of spaces. That only lines up for one specific input — as soon as the interpolated value changes length, or carries ANSI colour, the right border drifts.
theme::pad_right/theme::visual_lenalready solve this correctly (ANSI-aware, wide-char-aware); these three sites just weren't using them.Before
After
All rows pad to a named interior width; every border lines up.
Changes
core/stats/format/dashboard.rs— weekly-nudge card builds rows through apad_rightclosure, matching the hero box right above itcli/cheatsheet_cmd.rs— version right-aligned in a computed field instead of a literal space run (was also 1 column short of the frame)cli/config_cmd.rs—box_top/box_bottom/box_rowhelpers; rows now actually close, and both frames share oneSHOW_BOX_WVerification
Swept 86 read-only subcommands with a script that strips ANSI, measures each box row in terminal columns (wide chars = 2, combining/VS = 0) and flags rows whose width differs from the rest of their box. 26 boxes rendered; 3 misaligned rows before, 0 after.
Static sweep of every source literal containing
│ ┃ ║plus everybox_side()row builder found no further instances of the same bug shape.Scope caveat: 78 of the 86 commands print no box in a fresh environment (no data / not provisioned), so those paths are covered by the static sweep only.
Added
show_box_borders_line_up— asserts top, bottom and padded rows agree in visual width, including an overlong row that must truncate rather than overflow.cargo fmt/clippyclean (the one remaining clippy warning, a wildcard import incore/ocla/registry.rs, is pre-existing and untouched).🤖 Generated with Claude Code