Skip to content

Commit 8680ec3

Browse files
Isolator acmclaude
authored andcommitted
fix(editor): align selection highlight — integer line-height
The editor overlays a <textarea> on a highlight <pre>. With a fractional line box (line-height 1.7 * 13px = 22.1px) the textarea's internal text layout and the block <pre> rounded lines differently, so the native selection drifted upward from the painted glyphs, growing with line number (visible by ~line 37). Use an integer px line-height (22px) on .sql-editor so both lay out lines identically before `zoom: 1.2` scales them together, and match .sql-gutter > div height so the line numbers stay row-aligned. Verified in-browser: selection on a deep line now brackets the glyphs exactly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QennTvGKAtJZrv9EpQagef
1 parent 65a6d08 commit 8680ec3

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/styles.css

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,12 @@ body {
532532
position: relative;
533533
display: flex; width: 100%; height: 100%;
534534
font-family: var(--mono);
535-
font-size: 13px; line-height: 1.7;
535+
/* Integer px line-height (not unitless): the editor overlays a <textarea> on a
536+
highlight <pre>, and a fractional line box (1.7 * 13px = 22.1px) was rounded
537+
differently by the textarea's internal layout vs the block <pre>, so the
538+
native selection drifted upward from the painted glyphs, growing with line
539+
number. An integer line-height makes both lay out identically. */
540+
font-size: 13px; line-height: 22px;
536541
background: var(--bg-editor); color: var(--fg);
537542
overflow: hidden;
538543
}
@@ -546,7 +551,7 @@ body {
546551
overflow: hidden;
547552
font-variant-numeric: tabular-nums;
548553
}
549-
.sql-gutter > div { height: 1.7em; }
554+
.sql-gutter > div { height: 22px; }
550555
.sql-area { position: relative; flex: 1; overflow: hidden; }
551556
.sql-pre {
552557
position: absolute; inset: 0; margin: 0;

0 commit comments

Comments
 (0)