Fix #244: diff line selection with #L links #257

Merged
crueber merged 1 commit from fix/issue-244 into main 2026-09-09 21:08:38 +00:00
Owner

Implements crueber/walhub#244 (sequenced after #243, now merged): click/drag line selection with shareable #L links on commit diffs, landing on the right lines of the right chunks.

What changed (docs/go/12_web_ui.md §2.8 + Decisions entry in the same change):

  • NEW web/src/lib/diff-lines.js (pure, headless-testable): annotateHunkLines (@@-derived old/new numbers), annotateSplitRows (same splitRows() pairing with numbers zipped back on), unifiedNo/unifiedSide, diffLineHash/parseDiffHash file-scoped codec (#L / #OL + ranges; blob #L and #f- anchors parse to null), sameDiffSelection, matchAnnotated, chunkRange. Reuses rangeOf/dragRange from blob-lines.js (no duplication).
  • NEW web/src/components/DiffTable.jsx: shared selectable DiffBody for Commit.jsx + PullFiles.jsx (unified one gutter column, split two; per-hunk split headers; mousedown/drag/shift + keyboard Enter/Shift+Enter; replaceState drag frames, one push on click; cross-hunk/cross-side drags clamp; hash-load + hashchange re-highlight and scroll; unknown path/line highlights nothing; whole-row .line-hl, both themes).
  • PullFiles gains a per-file unified/split toggle (same renderer everywhere at once).
  • Drift-hash contract intact: parser output gains no fields, anchorContextSha pinned vector green.

URL scheme decision (per issue §2, picked + pinned): old-side selections use the O prefix (#OL12, ranges #OL12-OL20); split and unified share the hash.

Verification:

  • node --test: full web/test/unit suite 500/500 green (incl. new diff-lines.test.js, 19 tests).
  • vite build + esbuild SDK bundle clean; dist asset contains diff-num/diff-row rules and selection wiring.
  • Browser check (unified + split, both themes, zero console errors) is OPEN: shared obscura daemon blocks loopback; no private daemon per workspace rules. Needs a real-Chromium pass before merge.

No new deps (AGENTS.md law 1); no Go changes.

Implements crueber/walhub#244 (sequenced after #243, now merged): click/drag line selection with shareable #L links on commit diffs, landing on the right lines of the right chunks. What changed (docs/go/12_web_ui.md §2.8 + Decisions entry in the same change): - NEW web/src/lib/diff-lines.js (pure, headless-testable): annotateHunkLines (@@-derived old/new numbers), annotateSplitRows (same splitRows() pairing with numbers zipped back on), unifiedNo/unifiedSide, diffLineHash/parseDiffHash file-scoped codec (#<enc-path>L<n> / #<enc-path>OL<n> + ranges; blob #L and #f- anchors parse to null), sameDiffSelection, matchAnnotated, chunkRange. Reuses rangeOf/dragRange from blob-lines.js (no duplication). - NEW web/src/components/DiffTable.jsx: shared selectable DiffBody for Commit.jsx + PullFiles.jsx (unified one gutter column, split two; per-hunk split headers; mousedown/drag/shift + keyboard Enter/Shift+Enter; replaceState drag frames, one push on click; cross-hunk/cross-side drags clamp; hash-load + hashchange re-highlight and scroll; unknown path/line highlights nothing; whole-row .line-hl, both themes). - PullFiles gains a per-file unified/split toggle (same renderer everywhere at once). - Drift-hash contract intact: parser output gains no fields, anchorContextSha pinned vector green. URL scheme decision (per issue §2, picked + pinned): old-side selections use the O prefix (#<path>OL12, ranges #<path>OL12-OL20); split and unified share the hash. Verification: - node --test: full web/test/unit suite 500/500 green (incl. new diff-lines.test.js, 19 tests). - vite build + esbuild SDK bundle clean; dist asset contains diff-num/diff-row rules and selection wiring. - Browser check (unified + split, both themes, zero console errors) is OPEN: shared obscura daemon blocks loopback; no private daemon per workspace rules. Needs a real-Chromium pass before merge. No new deps (AGENTS.md law 1); no Go changes.
Shared selectable DiffBody (components/DiffTable.jsx) for Commit +
PullFiles: @@-derived gutters (unified one column, split two),
click/drag/shift selection with file-scoped shareable hashes
(#pathL<n>/OL<n> + ranges), chunk-clamped drags, hash-load
re-highlight + scroll. Numbering display-only: anchorContextSha
inputs untouched (pinned vector green). Decisions entry appended
in the same change.
Sign in to join this conversation.
No description provided.