Skip to content

Widen --wide by the five columns lf-diff's second line-number column added - #5686

Merged
max-sixty merged 2 commits into
mainfrom
fix/issue-5658-wide-diff-gutter
Nov 7, 2026
Merged

max-sixty merged 2 commits into
mainfrom
fix/issue-5658-wide-diff-gutter

Conversation

@leaf-agent

@leaf-agent leaf-agent commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

--wide is the width at which 100 columns of code read without wrapping beside a diff's gutter with four-digit line numbers, and tokens.css derives it from that gutter's width. #5611 numbered a diff's old and new lines in separate columns, which grew the gutter from digits + 5 to 2 × digits + 6 characters. The derivation still counted 109 characters, so the 100-column line in test_named_wide_is_the_evidence_width_of_a_document_layout scrolled 29px sideways. It now counts 114.

On screen. On document pages at windows wide enough for the cap, every block that names wide is about 41px wider (5 × 0.61 × 13.5px). That covers diffs and any data-width="wide" block. Workspaces and narrow windows don't change. In leaf-dev stills --state diff-long-lines, the diff gallery's actions move from 870.6px to 911.8px, and each wrapped line holds a few more characters:

Before:
before

After:
after

The other choice was to leave the width alone and accept 95 columns at four-digit line numbers. That would break the rule tokens.css states for --wide. #5611 meant to number both files, not to narrow the readable code, so this PR keeps the rule.

The journey fails on main 02a1e05cb and passes on this branch.

Refs #5658 — automated triage

--wide is the width at which 100 columns of code read unwrapped beside
a diff's gutter at four-digit line numbers, and tokens.css derives it
from that gutter's anatomy. #5611 numbered a diff's old and new lines
in separate columns, so the gutter grew from digits + 5 to
2 x digits + 6 characters, and the 100-column line in
test_named_wide_is_the_evidence_width_of_a_document_layout scrolled by
29px. The derivation now counts 114 characters, so a wide block on a
document page is about 5 code characters wider at a large window.

Refs #5658

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The width is right: lf-diff.js sets --lf-diff-gutter to 2 * digits + 4 ch, and widget-shadow.css starts the text at gutter + 2ch, so four-digit numbers give 114 columns. The claimed journey fails with main's tokens.css (assert 29 <= 0) and passes here. One fix to the comment is inline; I'll push it.

Comment thread browser/styles/tokens.css Resolved
geometry.css holds only the diff's vertical anatomy; the gutter's
2 × digits + 6 comes from lf-diff.js and widget-shadow.css. Comment only;
no behavior changes.
@max-sixty
max-sixty merged commit e1902c9 into main Nov 7, 2026
6 checks passed
@max-sixty
max-sixty deleted the fix/issue-5658-wide-diff-gutter branch November 7, 2026 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants