Fix #194 r2: line-number gutter alignment in both wrap modes #198

Merged
fen merged 1 commits from fix-194-r2 into dev 2026-09-10 17:11:08 +00:00
Collaborator

Revision 2 after the QA FAIL of PR #179 (issue #194). Two defects fixed:

Defect 2 (row accounting, wrap ON): splitLines() joined .codeline blocks with '\n' text nodes. Since .codeline is display:block, each interleaved newline text node rendered as an extra phantom visual row in the code column under pre-wrap, but renumber() counted only .codeline span heights — the gutter built one fewer row per line break and numbers drifted off alignment on wrapped lines (a line wrapping to 3 rows showed its number 2 rows early).

  • Fix: join('') so .codeline blocks are adjacent with no newline text between them (blocks already stack on their own).
  • Blank source lines become empty blocks; added .codeline:empty::before { content: "\200B"; } in app.css so empty blocks still occupy exactly one visual row.

Defect 1 (inline gutter spans, wrap ON): paste-lines.js appends .gutline spans with no separators, and the deployed build had no .gutline rule so all numbers landed on one row ("123 4"). The rule .code .gutter .gutline { display: block; } is already present in origin/dev (merged via PR #183, likely missed by the palette-dev deploy). No change needed in this PR; verified present.

Wrap OFF path: unchanged — gutter still gets '1\n2\n3\n4' text (N rows), and horizontal-scroll gutter behavior is untouched (no scrolling CSS changed; only an :empty line-box rule added).

CSP unchanged: no inline scripts/styles/handlers; changes are static JS + CSS only. go build ./... and go test ./... pass.

Revision 2 after the QA FAIL of PR #179 (issue #194). Two defects fixed: **Defect 2 (row accounting, wrap ON):** splitLines() joined .codeline blocks with '\n' text nodes. Since .codeline is display:block, each interleaved newline text node rendered as an extra phantom visual row in the code column under pre-wrap, but renumber() counted only .codeline span heights — the gutter built one fewer row per line break and numbers drifted off alignment on wrapped lines (a line wrapping to 3 rows showed its number 2 rows early). - Fix: join('') so .codeline blocks are adjacent with no newline text between them (blocks already stack on their own). - Blank source lines become empty blocks; added `.codeline:empty::before { content: "\200B"; }` in app.css so empty blocks still occupy exactly one visual row. **Defect 1 (inline gutter spans, wrap ON):** paste-lines.js appends .gutline spans with no separators, and the deployed build had no .gutline rule so all numbers landed on one row ("123 4"). The rule `.code .gutter .gutline { display: block; }` is already present in origin/dev (merged via PR #183, likely missed by the palette-dev deploy). No change needed in this PR; verified present. **Wrap OFF path:** unchanged — gutter still gets '1\n2\n3\n4' text (N rows), and horizontal-scroll gutter behavior is untouched (no scrolling CSS changed; only an :empty line-box rule added). CSP unchanged: no inline scripts/styles/handlers; changes are static JS + CSS only. go build ./... and go test ./... pass.
fen added 1 commit 2026-09-10 17:07:43 +00:00
Fix #194 r2: align line-number gutter in both wrap modes
CI / docker (pull_request) Skipped
CI / test (pull_request) Successful in 43s
1f5e671a43
QA FAIL of PR #179 (verified on palette-dev 2026-09-10) found two defects:

1) Row accounting: splitLines() joined .codeline blocks with '\n' text
   nodes. Since dee062d made .codeline display:block, each interleaved
   newline text node rendered as its own extra visual row in the code
   column under pre-wrap, but renumber() counted only .codeline span
   heights, so the gutter had one fewer row per line break and numbers
   drifted off alignment on wrapped lines. Fix: join('') so blocks are
   adjacent with no phantom newline rows; blank source lines become
   empty blocks given a line box via .codeline:empty::before (ZWJ) in
   app.css so they still count as one row.

2) Inline gutter spans: .gutline spans were appended with no separators
   and .code .gutter .gutline { display: block } did not exist on the
   deployed build, so all numbers landed on one row. That rule is
   present in origin/dev (merged via #183); kept unchanged and verified
   by rendering in a local build.

Wrap OFF path unchanged: gutter still gets '1\n2\n3\n4' text and the
horizontal-scroll gutter behavior is untouched (no CSS changes to
scrolling; only a :empty line-box rule). CSP unchanged: no inline
styles/handlers, static JS only.
fen merged commit 734d656f0c into dev 2026-09-10 17:11:08 +00:00
Sign in to join this conversation.