Skip to content

fix: number lf-diff's gutter in separate old and new columns - #5611

Merged
max-sixty merged 1 commit into
mainfrom
fix/issue-5605
Nov 6, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/issue-5605

Conversation

@leaf-agent

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

Copy link
Copy Markdown
Collaborator

lf-diff's gutter showed one number per row: the new file's for a context or added line, the old file's for a removed one. Once a hunk adds or removes lines the two counts drift apart, so in a later hunk the column ran out of order (15, 16, 15, 17 in the issue's repro), and nothing said which file a number counted. Each row now shows two columns, old then new, as a unified diff usually does. A removed row leaves the new cell blank and an added row leaves the old cell blank. Both numbers sit in the row's one gutter control, so a row still has one Comment press, and its accessible name and datum are unchanged. The gutter is 2 × digits + 4ch wide instead of digits + 3ch, which leaves three fewer columns for code at two-digit line numbers.

A new test in tests/browser/widgets/test_diffs.py renders the issue's patch and reads both columns, [13, 15] [14, 16] [15, ] [, 17] [16, 18]…, with the cells' right edges aligned. It fails on main and passes here.

Before and after, leaf-dev stills --state diff-long-lines:

before
after

Test changes
  • The refresh test now reads the number from the cell for its datum's side (old or new), not from the whole control's text.
  • The prose alignment test measured a Range over the button's contents. That range now includes the cells' line-high boxes, 2px above the glyphs, so the test measures the cells' text instead.
  • DIFF_CLIPPING measured a Range over the whole row. The wider gutter moved a wrap point in the print fixture so that a wrapped line ended at a space, and pre-wrap lets that space hang about 5px past the box. That is a blank space, not clipped text, but the old measurement counted it as cut. The test now measures each run of visible characters. Its screen half still finds the real overflow, a line about 300px too wide.

Closes #5605 — automated triage

lf-diff showed one line number per row: a context or added line's new-file
number, a removed line's old-file number. Once a hunk adds or removes lines
the two counts drift apart, so a later hunk's column ran out of order
(15, 16, 15, 17) with nothing saying which file a number counts. Each row's
one gutter control now holds two cells, old then new, as a unified diff
reads, and the gutter widens to fit both.

Tests: a new test reads both columns across a hunk that shifts the count. The
refresh test reads the number from its side's cell. The prose alignment test
and DIFF_CLIPPING measure text ink rather than element boxes and hanging
spaces, which the wider gutter exposed without any visible change.

Closes #5605
@max-sixty
max-sixty merged commit 8eb1a21 into main Nov 6, 2026
6 checks passed
@max-sixty
max-sixty deleted the fix/issue-5605 branch November 6, 2026 09:20
leaf-agent added a commit that referenced this pull request Nov 7, 2026
…#5551, #5552 and #5566 chose (#5685)

Ten of #5658's nightly journey cases still expected behavior that a
recent change replaced on purpose. This PR updates those tests to what
each change intended. One example page also changes: the feature gallery
had lost a face that the server would draw. Each case was bisected
locally to the first commit where it fails and checked against that
commit's parent, which passes. Each fails on main `02a1e05cb` and passes
on this branch.

| Case | Since | What changed |
| --- | --- | --- |
|
`test_render_widgets.py::test_notification_configuration_becomes_a_commentable_local_artifact`
| #5508 | Every playground choice now has its own id. The receipt's
comment anchors on the Banner choice that holds it (`format-banner`),
not on `notification-simulator`. |
|
`test_render_gate.py::test_every_table_the_theme_sets_honestly_passes_the_gate`
| #5566 | The fixture's available `<figure>` holds a question whose
words start at the figure's edge, and #5566's new `words-off-column`
advice flags exactly that. The journey checks tables, so it now leaves
that question out. The browser test that measures the question's table
inside the figure keeps it. |
|
`test_render_margin.py::test_margin_card_holds_its_top_as_a_turn_arrives_and_as_a_reply_wraps`
| #5537 | Beside its passage, a card now holds its reply's foot while
the user writes in it. The test now steps onto the thread with Escape
before reading, as #5537's own tests do. It checks that each wrap, a
long draft and the answer after a send grow the card upward. It is
renamed `…holds_its_top_while_read_and_its_reply_while_written`. |
|
`test_thread_response_continuity.py::…keep_the_first_line[margin-delete-desktop]`
| #5537 | Same rule: Backspace in a margin card's reply keeps the
reply's foot still, so the margin case reads the foot. The seat cases
are unchanged. |
|
`navigation/test_key_surfaces.py::test_user_news_interrupts_and_then_restores_background_news`
| #5448 | The panel's key now stands with Comment after the field's
words, so a notice reads `Agent replied — open Threads · Comment… c`. |
| `test_page_holds_still.py::…[message-reply-below-chromium]`,
`[…-firefox]` | #5551 | A thread's reply box under the floating panel
now counts as unseen. A clicked message therefore stays still as an
answer joins below it, the strict xfail passed, and its entries leave
`MOVES_ON_MAIN`. |
|
`test_render_navigation.py::test_the_feature_gallery_exercises_its_core_journeys`
| #5552 | `progressFace` reads a workflow's `at_work`, which the server
stamps on every served workflow. The gallery's margin atlas builds its
sample workflows from a stage alone, so its Working samples had lost the
working face. The sample now carries `at_work` as the server would stamp
it
(`examples/developer/feature-gallery.page/widgets/lf-margin-entry-gallery.js`).
|

The other #5658 cases are handled elsewhere. #5684 (merged) fixed the
fixture-resource case. A separate PR widens `--wide` for #5611's diff
gutter. The `message-edit-above` cases of `test_page_holds_still.py`
come from a runtime regression in #5551, which has its own cause issue.

Refs #5658 — automated triage

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty pushed a commit that referenced this pull request Nov 7, 2026
…added (#5686)

`--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](https://github.com/user-attachments/assets/42724439-1a1b-4f81-94d8-277416016474)

After:

![after](https://github.com/user-attachments/assets/158e9b37-23e2-4a97-8896-36d32f599aa5)

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

---------

Co-authored-by: leaf-agent <[email protected]>
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.

lf-diff's one gutter mixes old- and new-file line numbers, so they run out of order after a hunk that adds lines

2 participants