Link pills keep clear of the words beside them #584

Closed
kayg wants to merge 0 commits from issue/469-pill-room into dev
Owner

Fixes the link pills touching the text beside them (#469, #448), kayg's production report.

Cause: negative margins on .page .cm-link cancelled the pill's room, so the lit pill painted over neighbouring characters.

Fix (neighbour-aware): the editor (packages/editor/src/syntax/links.ts) marks each side of a link cm-link-sp-l|r (a space) or cm-link-tight-l|r (a comma, bracket, tag, another link touching, a line edge). The stylesheet gives the pill its room from that, in em tokens: next to a space the pill's edge sits inside the space, 0.175em clear of the next glyph, and the words after the link stay exactly where they were; next to anything else a small padding and the same clear gap.

Tests: pill-room.spec.ts (every link kind, neighbour, state; lit pill 2px clear of every neighbour; rest layout against the layout before links had room), links-parity and links-look updated, link-sides.test.ts for the classes. chromium and webkit, 390 and 1440; links, missing-links, editor, tint, svelte-check (0 errors), editor vitest (191 passed).

Before/after crops, rest and lit, are on #469. Open question for review: the pill hugs its text (see the comment on #469 for option B).

Refs #469, #448.

🤖 Generated with Claude Code

https://claude.ai/code/session_01U5oTUycqAh7DT72mdSUztk

Fixes the link pills touching the text beside them (#469, #448), kayg's production report. **Cause:** negative margins on `.page .cm-link` cancelled the pill's room, so the lit pill painted over neighbouring characters. **Fix (neighbour-aware):** the editor (`packages/editor/src/syntax/links.ts`) marks each side of a link `cm-link-sp-l|r` (a space) or `cm-link-tight-l|r` (a comma, bracket, tag, another link touching, a line edge). The stylesheet gives the pill its room from that, in em tokens: next to a space the pill's edge sits inside the space, 0.175em clear of the next glyph, and the words after the link stay exactly where they were; next to anything else a small padding and the same clear gap. **Tests:** `pill-room.spec.ts` (every link kind, neighbour, state; lit pill 2px clear of every neighbour; rest layout against the layout before links had room), `links-parity` and `links-look` updated, `link-sides.test.ts` for the classes. chromium and webkit, 390 and 1440; links, missing-links, editor, tint, svelte-check (0 errors), editor vitest (191 passed). Before/after crops, rest and lit, are on #469. Open question for review: the pill hugs its text (see the comment on #469 for option B). Refs #469, #448. 🤖 Generated with [Claude Code](https://claude.ai/code/session_01U5oTUycqAh7DT72mdSUztk) https://claude.ai/code/session_01U5oTUycqAh7DT72mdSUztk
Link pills keep clear of the words beside them (#469, #448)
Some checks failed
CI / server (pull_request) Successful in 23s
CI / web (pull_request) Failing after 40s
CI / rust (pull_request) Successful in 3m47s
e96418782a
The link's box at rest now holds the whole lit pill (padding .45em and the 1px edge) and a
clear gap of .2em outside it on both sides (margin: 0 .2em, was -(.45em + 1px) on the right and
-.25em on the left). Lighting the pill paints only inside its own room, so it still moves no word
and never touches the word, tag, comma or link beside it. Wrapped links keep the gap at the ends.

pill-room.spec.ts measures every link kind at rest, hovered, lit and in a selected block against
every neighbour (tag, word, comma, bracket, another link, line start and end, wrapped).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U5oTUycqAh7DT72mdSUztk
Author
Owner

Landed in train AF, #595.

Train AF ran the full suite: fmt, clippy, workspace tests (505 passed, 0 failed), the build, svelte-check, and every Playwright project in parallel shards.

Failures, each checked:

  • glass:268 (chromium-1440) passed 5 of 5 when repeated. It has now failed under full-suite load in trains AD, AE and AF, so it is tracked for a fix rather than called a one-off.

Contents:

  • #584 + #592 (variant C): link pills know what stands beside them. Next to a space nothing moves; before punctuation or a tag the pill has no inside padding and a 0.07em clear edge, so at rest it reads as normal spacing and when lit it never touches the neighbour's ink (#469, #448).
Landed in train AF, #595. Train AF ran the full suite: fmt, clippy, workspace tests (505 passed, 0 failed), the build, svelte-check, and every Playwright project in parallel shards. Failures, each checked: - `glass:268` (chromium-1440) passed 5 of 5 when repeated. It has now failed under full-suite load in trains AD, AE and AF, so it is tracked for a fix rather than called a one-off. Contents: - #584 + #592 (variant C): link pills know what stands beside them. Next to a space nothing moves; before punctuation or a tag the pill has no inside padding and a 0.07em clear edge, so at rest it reads as normal spacing and when lit it never touches the neighbour's ink (#469, #448).
kayg closed this pull request 2026-10-18 22:41:11 +00:00
Some checks failed
CI / server (pull_request) Successful in 23s
CI / web (pull_request) Failing after 40s
CI / rust (pull_request) Successful in 3m47s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal!584
No description provided.