Skip to content

fix(web): side-by-side diff layout with a sticky sideways scroll bar - #27

Merged
springfall2008 merged 2 commits into
mainfrom
fix/diff-layout
Nov 27, 2026
Merged

springfall2008 merged 2 commits into
mainfrom
fix/diff-layout

Conversation

@springfall2008

Copy link
Copy Markdown
Owner

Problem

In the Diff tab's split view, the line-number columns were as wide as the code and lines wrapped. A table with table-layout: fixed takes its column widths from its first row, which is the @@ hunk header spanning all four columns, so it made four equal columns. A first fix (lines kept whole, the card scrolling sideways) put the scroll bar at the bottom of long files, off screen, and pushed the new side off the right edge.

Fix

  • Columns: a colgroup gives narrow, fixed line-number columns (7ch) and two equal code halves, so old and new are always both visible.
  • Long lines: a line too long for its half is clipped, not wrapped. Its text sits in a span that the file's scroll bar shifts sideways.
  • Scroll bar: each file has one sideways scroll bar, position: sticky; bottom: 0, so it stays at the bottom of the visible diff while the file is on screen. It moves both sides together, keeping them aligned, and shows only when a line is clipped. Its range comes from the file's longest line (longestLine, tabs expanded at 4, tested) and the measured character width. It is recomputed on resize.
  • Trackpad: a sideways swipe, or shift+wheel, over a file scrolls it.
  • Small fixes: tab-size: 4, and a long hunk header ends with an ellipsis.

Tests

deno task check and 342 unit tests pass (a new longestLine test). Checked by the person in the browser.

🤖 Generated with Claude Code

springfall2008 and others added 2 commits November 27, 2026 12:15
…d of wrapping

The spanning hunk row made table-layout: fixed split the table into four
equal columns. A colgroup keeps line numbers narrow; the table is as wide as
its longest line and the file card scrolls sideways.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Long lines clip instead of pushing the new side off screen. Each file's bar
sticks to the bottom of the visible diff and shifts both sides together; a
sideways swipe or shift+wheel scrolls it too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@springfall2008
springfall2008 merged commit 4bb85b1 into main Nov 27, 2026
2 checks passed
@springfall2008
springfall2008 deleted the fix/diff-layout branch November 27, 2026 12:46
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.

1 participant