Repository navigation
Conversation
Add the Scroller's sideways range/clamp unit tests and a private-app E2E step that opens a file with a line far wider than the pane and asserts that pressing l/h moves the diff pane (the tail of a clipped line becomes reachable). Both fail on the current code: the Scroller has no sideways API and the diff pane binds no l/h, so the shots stay byte-identical.
…nes (#26) A line wider than the diff pane was cut at the right edge with no way to see the rest. Add opt-in horizontal scrolling to the shared Scroller (the file list leaves it off and is unchanged): - h/l and left/right scroll 4 columns a press; a trackpad's sideways swipe and shift+wheel scroll too; a draggable bottom thumb shows the position. The keys card lists them; in Preview they say "works in Diff". - The sideways range is measured, not estimated: each row reports its natural width, the range is the widest row seen plus two columns of room, it only grows (so it can't oscillate), and it resets on another file. One column's width comes from an invisible probe in the diff font. - Row tints and the selection paint across the full content width, while the cursor bar, note cards and the composer stay in the visible width. - All widths go through #25's unzoom() so they are right at any zoom.
Round 2 of the review's fix list, written failing first: - diffview.test.mjs pins displayColumns/widestColumns (wide glyphs count as two columns), the pure logic the data-driven range leans on. - drop scroller.test.mjs, whose tests poked the Scroller's internal fields. - run.sh's long-line step traces the diff pane's offsetX / rangeX / viewW and asserts behaviour (l raises the offset, enough l stops at range - width, h returns to 0, another file resets to 0); it SKIPs when no frames draw.
…wheel (#26) Reworks round 1 per the code review's fix list: - renderRow keeps the row tint, selection, cursor wash and bar on the outer row (bar at the left edge, no compensation); only the text moves, in one absolute layer at left(-offset). Drops ctx.contentW and the left(sx) trick. - the sideways range comes from the data, not from measuring drawn rows: the widest row's display columns (wide glyphs count as two) x the probed column width + 2 columns, recomputed when the diff loads and when the column width changes. So it shrinks after a reload or a smaller font. Drops measureWidth, ctx.onWidth, the per-row on_size_change and the only-grows rule. - wheel: always apply delta.x; delta.y sideways only on shift with delta.x 0; the horizontal scroller locks each event to its dominant axis, so a vertical swipe no longer drifts sideways. - reset the sideways offset whenever the shown file changes, including the error path of loadDiff (one resetScroll helper for both). - the probe reports one column's width (the /10 and unzoom live in diffview), passes cx and redraws on a change. Scroller mutators return 'changed'; the caller notifies. A thumb helper serves both axes. - names: ctx.offsetX (offset) vs GitDiff.sideways(dir) (action); the Scroller's width field is 'content', no more contentW/scrollX collisions. - traceFields carries offsetX/rangeX/viewW so the e2e can watch the scroll.
Owner
Author
This was referenced Nov 14, 2026
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.
Fixes #26
Problem
In the diff pane, a line wider than the pane was cut off at the right edge, and nothing brought the rest into view: no key, sideways swipe or shift+scroll. For minified JSON, lockfiles or long strings, the changed part of the line was often simply invisible.
Fix
The diff pane now scrolls sideways:
h/l(and ← / →) move 4 columns; they're listed in the keys card.Only the text moves: row colors, the selection, the cursor bar, note cards and the commit box stay put. The file list is unchanged. I chose sideways scrolling over soft wrap so every row keeps one height, which the cursor, selection and notes rely on. Line numbers still scroll with the text; pinning them is a possible follow-up.
Proof
A new step in
herdr-app/e2e/run.shtraces the pane's sideways offset and asserts:lraises it, enoughlstops with the line's end at the right edge (offset 1112 = range 1416 − width 304),hreturns to 0, another file starts at 0.node --test herdr-app/testpasses (46/46).