Fix #167 r2: gutter rows align with wrapped visual rows #193

Closed
fen wants to merge 1 commits from fix-167-r2 into dev
Collaborator

Round 2 for #167 (QA failed on #179/#183/#188).

  • Wrap ON row accounting now measures rendered geometry: rows per logical line = gap between consecutive .codeline tops / line-height, which correctly includes the pre-wrap newline rows between blocks that round-1 per-span-height rounding missed. Last line falls back to its own height.
  • Gutter rows remain block-level (.gutline display:block, already on dev) and numbers land on the first visual row of each line.
  • Wrap OFF path unchanged (plain text gutter, pre-PR behavior). CSP-safe: static JS only, no inline styles/scripts.

Verified with headless Chromium (CDP) against a local build: wrap ON — all line numbers delta 0.0px from their line top, incl. a line wrapping to 3 rows; gutter 14 block rows, stable after settle (no ResizeObserver feedback). Wrap OFF — gutter 1\n2\n3\n4\n5. go test ./internal/web/ ok.

Round 2 for #167 (QA failed on #179/#183/#188). - Wrap ON row accounting now measures rendered geometry: rows per logical line = gap between consecutive .codeline tops / line-height, which correctly includes the pre-wrap newline rows between blocks that round-1 per-span-height rounding missed. Last line falls back to its own height. - Gutter rows remain block-level (.gutline display:block, already on dev) and numbers land on the first visual row of each line. - Wrap OFF path unchanged (plain text gutter, pre-PR behavior). CSP-safe: static JS only, no inline styles/scripts. Verified with headless Chromium (CDP) against a local build: wrap ON — all line numbers delta 0.0px from their line top, incl. a line wrapping to 3 rows; gutter 14 block rows, stable after settle (no ResizeObserver feedback). Wrap OFF — gutter `1\n2\n3\n4\n5`. go test ./internal/web/ ok.
fen added 1 commit 2026-09-10 16:54:22 +00:00
Fix #167 r2: measure wrapped rows from rendered line geometry
CI / docker (pull_request) Skipped
CI / test (pull_request) Successful in 47s
71c53b65f3
Round-1 accounting rounded each .codeline span's own height to rows, but
in pre-wrap the newline text nodes between blocks each render as their own
anonymous row, so per-span height undercounts and gutter numbers drift
below their line's first visual row. Renumber now derives rows per line
from the rendered gap between consecutive line tops (wrapped rows plus the
newline row); the last line falls back to its own box height. Wrap-off
path unchanged.
fen closed this pull request 2026-09-10 16:54:23 +00:00
fen deleted branch fix-167-r2 2026-09-10 16:54:23 +00:00

Pull request closed

This pull request cannot be reopened because the branch was deleted.
Sign in to join this conversation.