Fix #167 r2: fix undefined tops ref in renumber settle-check #206

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

Revision follow-up for #167 / PR #179 line of work.

The settle-check pass in renumber() referenced an undeclared variable tops, so every wrap-on renumber threw 'ReferenceError: tops is not defined' and the one-frame re-verification never ran. This restores the intended idempotent settle-check (captures placed rows from measured codeline tops and re-runs if reflow moves any line).

Verified locally (fresh build, headless chromium + CDP probes): 5-line paste with long unbroken line 3, wrap ON at 1400x900 and 375x812 -> one .gutline per visual row, every number dRow=0/dPx=0 vs its line start, no horizontal scroll; wrap OFF unchanged ('1\n2\n3\n4\n5'); zero console/CSP errors. go build ./... && go test ./... pass.

Fixes #167

Revision follow-up for #167 / PR #179 line of work. The settle-check pass in renumber() referenced an undeclared variable `tops`, so every wrap-on renumber threw 'ReferenceError: tops is not defined' and the one-frame re-verification never ran. This restores the intended idempotent settle-check (captures placed rows from measured codeline tops and re-runs if reflow moves any line). Verified locally (fresh build, headless chromium + CDP probes): 5-line paste with long unbroken line 3, wrap ON at 1400x900 and 375x812 -> one .gutline per visual row, every number dRow=0/dPx=0 vs its line start, no horizontal scroll; wrap OFF unchanged ('1\n2\n3\n4\n5'); zero console/CSP errors. go build ./... && go test ./... pass. Fixes #167
fen added 1 commit 2026-09-10 17:29:32 +00:00
Fix #167 r2: measure-based gutter rows + fix undefined tops ref in renumber
CI / docker (pull_request) Skipped
CI / test (pull_request) Successful in 45s
64bf4b225e
QA of the #167 follow-up found two defects:
1) renumber() referenced an undefined 'tops' variable in the rAF
   re-verification pass, so any wrap toggle that reflowed a partially
   filled last visual row left stale (non-idempotent) numbering.
2) rows were derived from per-span heights while the code column also
   renders newline text nodes between .codeline blocks, so the gutter
   could drift from the code column's real visual rows.

renumber() now measures each .codeline's actual offsetTop and places
every number on the visual row its line starts on (a line wrapping to N
rows gets its number on the first of them), pads filler rows in between,
and self-corrects one frame later if reflow moves any line. Wrap-OFF
path stays unchanged ('1
2
3
4'). Verified in headless Chromium:
gutter/code row alignment exact at 1200px and 640px, toggle cycles
stable, no horizontal scroll, no CSP console errors; go build/test pass.
fen closed this pull request 2026-09-10 17:30:24 +00:00
Author
Collaborator

Closing as superseded: the fix landed via fix-167-r2 (dev tip 5c6cd40, QA passed 2026-09-10). Issue is closed; deleting the stale fix-167 branch per branch hygiene.

Closing as superseded: the fix landed via fix-167-r2 (dev tip 5c6cd40, QA passed 2026-09-10). Issue is closed; deleting the stale fix-167 branch per branch hygiene.

Pull request closed

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