renumber() referenced an undefined tops variable in the requestAnimationFrame re-verification pass, so a wrap toggle that reflowed a partially filled last visual row could leave stale, non-idempotent numbering (one extra blank row after OFF-to-ON at some widths).
Row accounting was 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 real rendered 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), padding filler rows in between, so gutter rows always reproduce the code column's actual visual rows.
the rAF re-verification pass is fixed and self-corrects placement if reflow moves any line.
wrap OFF path unchanged: plain '1\n2\n3\n4' with one number per logical line.
Verified in headless Chromium against a local build (test paste: 4 lines, line 3 a 300-char unbroken token, wrap ON): number-to-first-visual-row alignment exact at 1200px and 640px, wrap OFF untouched, repeated toggle cycles stable, no horizontal scrolling (overflow-wrap anywhere), console free of CSP violations; go build ./... and go test ./... pass.
Fixes #167 (QA fail on the #167 follow-up).
Two defects in the previous fix:
1) renumber() referenced an undefined `tops` variable in the requestAnimationFrame re-verification pass, so a wrap toggle that reflowed a partially filled last visual row could leave stale, non-idempotent numbering (one extra blank row after OFF-to-ON at some widths).
2) Row accounting was 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.
Changes (internal/web/static/paste-lines.js only):
- renumber() now measures each .codeline's real rendered 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), padding filler rows in between, so gutter rows always reproduce the code column's actual visual rows.
- the rAF re-verification pass is fixed and self-corrects placement if reflow moves any line.
- wrap OFF path unchanged: plain '1\n2\n3\n4' with one number per logical line.
Verified in headless Chromium against a local build (test paste: 4 lines, line 3 a 300-char unbroken token, wrap ON): number-to-first-visual-row alignment exact at 1200px and 640px, wrap OFF untouched, repeated toggle cycles stable, no horizontal scrolling (overflow-wrap anywhere), console free of CSP violations; go build ./... and go test ./... pass.
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.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Fixes #167 (QA fail on the #167 follow-up).
Two defects in the previous fix:
renumber() referenced an undefined
topsvariable in the requestAnimationFrame re-verification pass, so a wrap toggle that reflowed a partially filled last visual row could leave stale, non-idempotent numbering (one extra blank row after OFF-to-ON at some widths).Row accounting was 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.
Changes (internal/web/static/paste-lines.js only):
Verified in headless Chromium against a local build (test paste: 4 lines, line 3 a 300-char unbroken token, wrap ON): number-to-first-visual-row alignment exact at 1200px and 640px, wrap OFF untouched, repeated toggle cycles stable, no horizontal scrolling (overflow-wrap anywhere), console free of CSP violations; go build ./... and go test ./... pass.
Pull request closed