#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
1 Commits
Author SHA1 Message Date
fen 4050f1362e #257: size the paste gutter to the widest line number
CI / docker (pull_request) Skipped
CI / test (pull_request) Successful in 22s
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.
2026-09-17 14:37:27 -05:00