Fix #167: undefined 'tops' reference aborted renumber() with wrap on #204

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

Follow-up to PR #200 (already merged to dev): commit e1056df rebuilt renumber() to place gutter numbers by measured .codeline geometry (correct approach), but the one-frame verification pass still read the removed tops array (line 80) — an Uncaught ReferenceError inside renumber() that aborts the function before any number is assigned, leaving the wrap-ON gutter as blank filler rows.

Fix: read the placement from the already-computed rowIdx array instead of the removed tops.

Local verification (CDP bounding-box probes against a fresh build of this branch, 6-line paste including one long unbroken token that wraps mid-word):

scenario lines max |number top − codeline top| console/CSP errors
1400x900 wrap ON 6 (9 visual rows) 0.0px 0
1400x900 wrap OFF 6 0.1px 0
375x812 wrap ON 6 0.0px 0
375x812 wrap OFF 6 0.0px 0

Wrap OFF keeps the pre-existing plain 1..N text gutter with no .gutline spans. Gutter height equals code body height in every scenario (codeH == gutH). go build ./... and go test ./... pass.

Ref #167

Follow-up to PR #200 (already merged to dev): commit e1056df rebuilt renumber() to place gutter numbers by measured .codeline geometry (correct approach), but the one-frame verification pass still read the removed `tops` array (line 80) — an Uncaught ReferenceError inside renumber() that aborts the function **before any number is assigned**, leaving the wrap-ON gutter as blank filler rows. **Fix:** read the placement from the already-computed `rowIdx` array instead of the removed `tops`. **Local verification (CDP bounding-box probes against a fresh build of this branch, 6-line paste including one long unbroken token that wraps mid-word):** | scenario | lines | max \|number top − codeline top\| | console/CSP errors | |---|---|---|---| | 1400x900 wrap ON | 6 (9 visual rows) | 0.0px | 0 | | 1400x900 wrap OFF | 6 | 0.1px | 0 | | 375x812 wrap ON | 6 | 0.0px | 0 | | 375x812 wrap OFF | 6 | 0.0px | 0 | Wrap OFF keeps the pre-existing plain `1..N` text gutter with no .gutline spans. Gutter height equals code body height in every scenario (codeH == gutH). go build ./... and go test ./... pass. Ref #167
fen added 1 commit 2026-09-10 17:26:34 +00:00
Fix #167: remove undefined 'tops' reference that aborted renumber() with wrap on
CI / docker (pull_request) Skipped
CI / test (pull_request) Successful in 48s
ccaa1292a1
Commit e1056df refactored renumber() to place gutter numbers by measured
.codeline geometry but left the one-frame verification pass reading the
removed 'tops' array — a ReferenceError at line 80 that aborts renumber()
before any number is assigned, leaving the wrap-ON gutter with blank filler
rows. Read the placement from the already-computed rowIdx array instead.

Verified locally (CDP bounding-box probes, 6-line paste incl. one long
unbroken token that wraps mid-word): gutter number top vs .codeline top
diff <= 0.1px for every line at 1400x900 and 375x812, wrap ON and OFF.
Wrap OFF keeps the plain '1..N' text gutter with no .gutline spans.
No console or CSP violations.
fen closed this pull request 2026-09-10 17:27:03 +00:00
fen deleted branch fix-167 2026-09-10 17:27:03 +00:00

Pull request closed

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