fix(editor): pin line-height to integer px so the caret stays aligned
Some checks failed
Deploy to GitHub Pages / build (push) Failing after 23s
Deploy to GitHub Pages / deploy (push) Has been skipped

A fractional line box (0.8rem × 1.6) is rounded differently by the
textarea than by the <pre> backdrop, so the caret drifted further from
its glyph the lower it sat — worst at the bottom of a tall file.
This commit is contained in:
Julien Calixte
2026-06-19 18:55:42 +02:00
parent be86b82823
commit b6f7bcab82

View File

@@ -228,7 +228,11 @@ function syncScroll() {
padding: 0.9rem 1rem; padding: 0.9rem 1rem;
font-family: inherit; /* Fira Code, from the global theme */ font-family: inherit; /* Fira Code, from the global theme */
font-size: 0.8rem; font-size: 0.8rem;
line-height: 1.6; /* Integer px, NOT a unitless ratio: a fractional line box (0.8rem × 1.6 =
20.48px) is rounded differently by a <textarea> than by the <pre> backdrop,
so the caret drifts further from its glyph the more lines precede it —
visible at the bottom of a tall file. An integer height rounds identically. */
line-height: 20px;
tab-size: 2; tab-size: 2;
white-space: pre; white-space: pre;
} }