Skip to content

style(preview-ui): distinguish wrapped rows from new lines by spacing - #133

Merged
ompugao merged 1 commit into
masterfrom
tweak/preview-line-spacing
Aug 21, 2026
Merged

style(preview-ui): distinguish wrapped rows from new lines by spacing#133
ompugao merged 1 commit into
masterfrom
tweak/preview-line-spacing

Conversation

@ompugao

@ompugao ompugao commented Aug 21, 2026

Copy link
Copy Markdown
Owner

Problem

In the content view, a wrapped line is hard to tell apart from a new line at a glance.

Why it happened

Rows inside a wrapped line are separated by leading-relaxed (line-height 1.625). Sibling lines were separated by… the same amount — they are plain stacked <div>s with no margin between them (VirtualRenderer.tsx:101, and the children container at :118 only applied mt-0.5 once around the whole group). The spacing signal was a 1:1 tie, so a wrap and a new line looked identical.

Change

Invert the ratio, using vertical space only:

Where Before After
Line box leading-relaxed (1.625) leading-snug (1.375)
Children group mt-0.5 mt-1.5 space-y-1.5
Top-level block py-0.5 py-[3px]

At the 16px body size that is roughly 6px of air inside a wrap vs 12px between lines.

Horizontal position is untouched deliberately: a hanging indent would risk reading as a real indent level in an indent-structured format, and a bullet marker would eat into the indent width. The indent guides are unchanged.

Notes

  • npx tsc --noEmit clean; utilities verified present in the built CSS/JS.
  • The row virtualizer re-measures via measureElement, so the height change settles without jitter on scroll.
  • Being trialled in daily use before merge — the knobs are the two 1.5s and the 3px (all 6px) if the gap wants tuning.

🤖 Generated with Claude Code

Rows inside a wrapped line were separated by line-height 1.625, and
sibling lines by... the same amount, since sibling line boxes carry no
margin. With the spacing signal tied, a wrap and a new line looked
identical.

Invert the ratio: tighten intra-line leading to 1.375 and put 6px
between sibling lines (children groups and top-level blocks alike), so
roughly 6px of air inside a wrap versus 12px between lines. Nothing
moves horizontally, so a wrap cannot be misread as an indent level and
the indent guides are untouched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ompugao
ompugao deleted the branch master August 21, 2026 04:06
@ompugao ompugao closed this Aug 21, 2026
@ompugao ompugao reopened this Aug 21, 2026
@ompugao
ompugao changed the base branch from fix/preview-ws-port to master August 21, 2026 04:07
@ompugao
ompugao merged commit fda8345 into master Aug 21, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant