From ccaa1292a18698810fc2cf96475c8f96b2ae8ba6 Mon Sep 17 00:00:00 2001 From: fen Date: Thu, 10 Sep 2026 12:26:14 -0500 Subject: [PATCH] Fix #167: remove undefined 'tops' reference that aborted renumber() with wrap on MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- internal/web/static/paste-lines.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/web/static/paste-lines.js b/internal/web/static/paste-lines.js index 231a473..c61ce21 100644 --- a/internal/web/static/paste-lines.js +++ b/internal/web/static/paste-lines.js @@ -77,7 +77,7 @@ // gutter pass that changes the code column width reflows it. Verify the // placement one frame later and re-run if any line's row moved (#167). var placed = {}; - for (var q = 0; q < tops.length; q++) placed[q] = Math.round((tops[q] - bodyTop) / lh); + for (var q = 0; q < rowIdx.length; q++) placed[q] = rowIdx[q]; requestAnimationFrame(function () { var moved = false; var tops2 = [];