#257: size line number gutter to widest number #266

Merged
fen merged 1 commits from fix-257 into dev 2026-09-17 19:38:56 +00:00
Collaborator

Fix attempt 1.

The paste gutter was pinned to a fixed 3ch width; with box-sizing: border-box that leaves only ~19px of content after the 10px side padding, so 2+ digit line numbers overflowed right into the code text.

Fix: paste-lines.js now sizes the gutter to the widest line number via CSSOM: calc(Nch + 20px) where N = digits of the highest line number. Numbers are right-aligned; the column matches the biggest number. Width is only written when it changes so the renumber/resize loop stays stable.

Verified with CDP probes at 1400x900 and 375x812, wrap on and off: gutter numbers end ~10-11px left of the code column, zero overlap, no CSP console entries, go build/test pass.

Ref #257

Fix attempt 1. The paste gutter was pinned to a fixed `3ch` width; with box-sizing: border-box that leaves only ~19px of content after the 10px side padding, so 2+ digit line numbers overflowed right into the code text. Fix: paste-lines.js now sizes the gutter to the widest line number via CSSOM: `calc(Nch + 20px)` where N = digits of the highest line number. Numbers are right-aligned; the column matches the biggest number. Width is only written when it changes so the renumber/resize loop stays stable. Verified with CDP probes at 1400x900 and 375x812, wrap on and off: gutter numbers end ~10-11px left of the code column, zero overlap, no CSP console entries, go build/test pass. Ref #257
fen added 1 commit 2026-09-17 19:37:45 +00:00
#257: size the paste gutter to the widest line number
CI / docker (pull_request) Skipped
CI / test (pull_request) Successful in 22s
4050f1362e
The paste gutter was pinned to a fixed 3ch width. With box-sizing:
border-box that leaves only ~19px of content after the 10px+10px side
padding, so 2+ digit line numbers overflow right into the code text
(owner-visible from line 10, worst at 100+).

paste-lines.js now sets the gutter width to calc(Nch + 20px), where N is
the digit count of the highest line number, via CSSOM (CSP forbids
inline style attributes). Numbers were already right-aligned; the column
now matches the width of the biggest number. The width is only written
when it changes, so the resize-observer/renumber loop keeps a stable
fixed point.
fen merged commit 1872dac8b4 into dev 2026-09-17 19:38:56 +00:00
Sign in to join this conversation.