fix(model): line the card's values up in one column - #46
Merged
Conversation
Every "label: value" line in [info] and [notes] pads its label through cardLabel to the single cardLabelWidth, so the values stop stepping in and out by a few cells each. ui.MetaDetailLabelStyle lost its Width(8): it padded the [notes] labels while [info] had no padding at all, which is exactly what made the two sections disagree. The two wrapped values (note, tags) wrap to inner-cardLabelWidth instead of the full inner width — the first line used to run one label's worth of cells past the panel edge, where the viewport truncates it — and their continuations hang under the value column via hangIndent instead of falling back to column 0. installed: and latest: both print through version.DisplayVersion, which puts a v in front of a bare version number: a tool's --version says 1.10.2 where its release is tagged v1.10.2, so the same binary read as two different things. It edits nothing else — canonSemver only decides whether the string is a version number at all, and its own output is deliberately not what gets displayed, since it drops zero-padding, a 4th segment and build metadata. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The value column costs 13 of the 28 cells the brief panel has at the 80x24 baseline, which is where "repo: github.com/owner/name" was cut mid-name. The host is implied, so the value now shows the bare owner/repo from loader.NormalizeRepo and the line comes out 4 cells shorter than it was before the column existed. The link is untouched: it stays "https://" + t.GitHub, exactly what [o] opens. A ref NormalizeRepo rejects — an unsupported or spoofed host like github.com.evil.com/x/y — renders in full instead, since shortening exactly there would hide the host that makes the link not what it looks like. Also names a known gap in TestCardNoteWrapsUnderItsLabel: it measures display cells while wrapText counts runes, so its ASCII fixture is deliberate — a CJK note still overflows, which is wrapText's limitation and not the value column's. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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
[info]and[notes]sections each indented their values differently —[notes]labels were padded to 8 byui.MetaDetailLabelStyle,[info]labels were not padded at all — so every line started its value at its own column.Before / after (the two-space gap on
installed:/latest:is theversion glyph, invisible without a nerd font):What changed
cardLabelpads every label tocardLabelWidth(len("maintenance:")+1, the widest label the card can print) — the single definition of the column.ui.MetaDetailLabelStylelost itsWidth(8)so the two cannot drift.note/tagswrap toinner - cardLabelWidthinstead of the fullinner: the first line used to run a label's worth of cells past the panel edge, where the viewport truncates (it does not soft-wrap). Continuations go throughhangIndentand sit under the value column instead of column 0.installed:andlatest:spell versions the same way. Both print through the newversion.DisplayVersion, which puts avin front of a bare version number — a tool's--versionsays1.10.2where its release is taggedv1.10.2. It edits nothing else:canonSemveronly decides whether the string is a version number (nightly,cli-2.0pass through), and its own output is deliberately not displayed since it drops zero-padding, a 4th segment and build metadata.Accepted cost
At the 80×24 baseline the brief panel is 30 cells wide, so the column spends 13 of them and a long
repo:value is truncated sooner than before (thelatest:line with its date suffix already overflowed at that width).Tests
TestCardValuesShareOneColumn— walks everylabel:line of a fully-populated card, fails on any value starting elsewhere; a completeness check keeps the fixture covering every gated line.TestCardNoteWrapsUnderItsLabel— wrap width and hanging indent.TestDisplayVersion— thevis the only edit; zero-padding, a 4th segment and build metadata survive verbatim, non-versions pass through.Preflight green:
go build/go vet/go test -race ./.../golangci-lint run(0 issues).🤖 Generated with Claude Code