Fix: editing-side line spacing #77

Closed
opened 2026-10-06 15:30:27 +02:00 by AlexKucera · 7 comments
Owner

Part of #20

Question

Expanded 2026-10-08 (Alexander, live): with reading ruled calm (#78), the writing side needs the same polish — "the writing side should probably look as close as possible to the reading side, but with plain Markdown." This supersedes the original line-spacing-only scope; that defect is one item in the parity list below.

The editor (TextKit2, ProsePresenter attribute map over a plain store — ADR-0010 mode B) must reach visual parity with the calm-ruled reading surface (Museion/Resources/reading.css, #78). Marks stay visible-dimmed everywhere — the plain store is the source of truth; styling is presentation-only.

Decided (Alexander, this session — see round comment):

  1. Leading: 1.5 → 1.8 (reading's --lh). Same lineHeightMultiple knob exists today, value change only.
  2. Heading ladder: h1 26 → 30, h2 20 → 22 (reading: 26px * 1.15 / * 0.85); new h3 kind (### , size 19 = body×1.12, Concourse OT w600); ####+ → bold body (reading h4+ floors at bold body). Headings bold in the headings face (Concourse OT Semibold family members), as reading renders them.
  3. Inline traits: **bold**, _italic_, `code` get real traits on content (bold/italic body font, mono 14); link labels [label](url) styled ink + underline like reading (both brackets and parens dimmed). Marks stay dimmed-visible.
  4. Blank source lines: half-height — ~9pt font on empty lines ≈ 15px visual gap, structure stays visible. (Reading collapses to 17px; 15px in-editor is close enough, Alexander's call.)
  5. Block parity:
    • Quotes (> ): secondary ink (#48484d from CSS --secondary) + 20px left indent (firstHeadIndent — visible in source).
    • Code-fence interiors: mono 14, as reading's pre.
    • List markers (- , 1. , nested markers): dimmed.
    • Tables: stay plain body — booktabs is impossible in a source view; alignment/pipes untouched.
  6. Heading spacing: none first pass — visible blank lines carry the separation; add values at the visual check if it feels tight (one-line change later).
  7. Not copied from reading: hover effects, ::selection tinting, measure width (the editor keeps its full-column measure), booktabs borders, image popovers.

Done = build + tests + Alexander's eyes in-app on the calibration piece + kitchen-sink (both in spike/prose/), ruling at the visual check. Execution lands on branch wayfinder/76-apex-html-reading (the polished line) — follow-up commits, same branch, per map convention for defect fixes after a build session closed.

[Generated by AI]

Part of #20 ## Question **Expanded 2026-10-08** (Alexander, live): with reading ruled calm (#78), the writing side needs the same polish — "the writing side should probably look as close as possible to the reading side, but with plain Markdown." This supersedes the original line-spacing-only scope; that defect is one item in the parity list below. The editor (TextKit2, `ProsePresenter` attribute map over a plain store — ADR-0010 mode B) must reach visual parity with the calm-ruled reading surface (`Museion/Resources/reading.css`, #78). Marks stay visible-dimmed everywhere — the plain store is the source of truth; styling is presentation-only. Decided (Alexander, this session — see round comment): 1. **Leading:** 1.5 → **1.8** (reading's `--lh`). Same `lineHeightMultiple` knob exists today, value change only. 2. **Heading ladder:** h1 26 → **30**, h2 20 → **22** (reading: `26px * 1.15` / `* 0.85`); new **h3** kind (`### `, size 19 = body×1.12, Concourse OT w600); `####`+ → **bold body** (reading h4+ floors at bold body). Headings bold in the headings face (Concourse OT Semibold family members), as reading renders them. 3. **Inline traits:** `**bold**`, `_italic_`, `` `code` `` get real traits on content (bold/italic body font, mono 14); **link labels** `[label](url)` styled ink + underline like reading (both brackets and parens dimmed). Marks stay dimmed-visible. 4. **Blank source lines:** half-height — ~9pt font on empty lines ≈ 15px visual gap, structure stays visible. (Reading collapses to 17px; 15px in-editor is close enough, Alexander's call.) 4. **Block parity:** - Quotes (`> `): secondary ink (#48484d from CSS `--secondary`) + 20px left indent (firstHeadIndent — visible in source). - Code-fence interiors: mono 14, as reading's `pre`. - List markers (`- `, `1. `, nested markers): dimmed. - Tables: stay plain body — booktabs is impossible in a source view; alignment/pipes untouched. 5. **Heading spacing: none first pass** — visible blank lines carry the separation; add values at the visual check if it feels tight (one-line change later). 6. **Not copied from reading:** hover effects, `::selection` tinting, measure width (the editor keeps its full-column measure), booktabs borders, image popovers. **Done =** build + tests + Alexander's eyes in-app on the calibration piece + kitchen-sink (both in `spike/prose/`), ruling at the visual check. Execution lands on branch `wayfinder/76-apex-html-reading` (the polished line) — follow-up commits, same branch, per map convention for defect fixes after a build session closed. [Generated by AI]
AlexKucera added the wayfinder:task label 2026-10-06 15:30:52 +02:00
AlexKucera changed title from Part of #20 to Fix: editing-side line spacing 2026-10-06 15:30:52 +02:00
AlexKucera self-assigned this 2026-10-08 10:52:04 +02:00
Author
Owner

Scope-expansion round (2026-10-08, Alexander live)

#77's original scope was the line-spacing defect alone. Alexander expanded it live: with reading ruled calm (#78), the writing side should look "as close as possible to the reading side, but with plain Markdown" — line spacing, font sizes, bold/italic applied to the Markdown, headers bold, etc.

Grounding: Museion/ProsePresenter.swift (attribute map: 1.5 leading, h1 26 / h2 20, no h3 kind, quotes/fences/lists plain body, marks char-dimmed only — no content traits) vs the calm-ruled Museion/Resources/reading.css (#78: lh 1.8, para 17px, h1 30 / h2 22 / h3 = body×1.12 w600 / h4+ bold body, quotes secondary-ink + 3px rail, code mono 14, links ink + underline).

Four taste calls asked; answers folded into the body:

  1. Blank source lines — half-height (~9pt on empty lines ≈ 15px gap): closest to reading's rhythm while structure stays visible.
  2. Inline traits scope — bold, italic, inline code, AND link labels (ink + underline like reading). Not full-apex parity.
  3. Block parity — quotes secondary ink + 20px indent, fence interiors mono 14, list markers dim; tables stay plain body.
  4. Heading spacing — none first pass; blank lines carry it, add values at the visual check if tight.

Uncontroversial parity (no round needed): leading 1.8, h1 30 / h2 22, new h3 19 w600, ####+ bold body, headings bold in the headings face.

[Generated by AI]

## Scope-expansion round (2026-10-08, Alexander live) #77's original scope was the line-spacing defect alone. Alexander expanded it live: with reading ruled calm (#78), the writing side should look "as close as possible to the reading side, but with plain Markdown" — line spacing, font sizes, bold/italic applied to the Markdown, headers bold, etc. Grounding: `Museion/ProsePresenter.swift` (attribute map: 1.5 leading, h1 26 / h2 20, no h3 kind, quotes/fences/lists plain body, marks char-dimmed only — no content traits) vs the calm-ruled `Museion/Resources/reading.css` (#78: lh 1.8, para 17px, h1 30 / h2 22 / h3 = body×1.12 w600 / h4+ bold body, quotes secondary-ink + 3px rail, code mono 14, links ink + underline). Four taste calls asked; answers folded into the body: 1. **Blank source lines** — half-height (~9pt on empty lines ≈ 15px gap): closest to reading's rhythm while structure stays visible. 2. **Inline traits scope** — bold, italic, inline code, AND link labels (ink + underline like reading). Not full-apex parity. 3. **Block parity** — quotes secondary ink + 20px indent, fence interiors mono 14, list markers dim; tables stay plain body. 4. **Heading spacing** — none first pass; blank lines carry it, add values at the visual check if tight. Uncontroversial parity (no round needed): leading 1.8, h1 30 / h2 22, new h3 19 w600, `####`+ bold body, headings bold in the headings face. [Generated by AI]
Author
Owner

Status — build landed, visual pass owed

Per map convention (build session closed, defect/polish work continues on the same branch): the #77 parity build landed as follow-up commits on wayfinder/76-apex-html-reading @ 8fe5f48 (feature) + 3934b10 (DOX), local, unpushed.

What landed (Museion/ProsePresenter.swift rewritten, ProseTypography.swift extended, ProsePresenterTests.swift new):

  • Leading: calibrated to reading's CSS 1.8 via font metrics (17pt × 1.8 / natural box), not the raw CSS number — TextKit's lineHeightMultiple multiplies the font's natural box (~1.2×), copying 1.8 verbatim would overshoot ~20%. The old 1.5 constant happened to sit near CSS-1.8's true value; the calibration makes the parity exact and self-documenting.
  • Heading ladder: h1 26→30, h2 20→22 (Concourse Semibold), new h3 kind (### , 19pt body-face bold ≈ CSS w600), h4+ bold body. Marker hashes dim.
  • Blank source lines: 9pt half-height separators (Alexander's pick).
  • Quotes: secondary ink #48484d + 20pt indent (firstLineHeadIndent + headIndent), marker dim.
  • Fence interiors: mono-14 ink on substrate tint; delimiters dim (fence-state scan of the document prefix feeds per-paragraph reattribute).
  • List markers (- , 1. , nested): dim.
  • Inline traits: **bold** bold, _italic_ italic (CommonMark intraword-underscore never emphasizes — file_name_here stays plain), `code` mono-14, link labels ink + muted underline with brackets/URL dim. Marks stay visible-dimmed everywhere (plain store is the source of truth).
  • Tables stay plain body (ruled: booktabs is impossible in a source view).

Verification: 103 unit tests green (11 new pinning ladder/blanks/quote/fence/traits/intraword rule), lint 0 errors (warnings at the neighbors' tolerated level), SwiftFormat clean, GitNexus graph check run (high risk = the presenter is the editor's core styling path; affected flows are exactly the two intended: load + per-paragraph reattribute).

Owed: Alexander's visual pass in-app (done condition). The launch + capture path was blocked by a dead screen-capture instrument (all screenshots black while the app process and its window are verified alive via CGWindowList — the known wallpaper-capture trap; not an app defect). App is built and launched from wayfinder/76-apex-html-reading tip. Read kitchen-sink + the calibration piece in the editor; if spacing feels tight, heading paragraphSpacing values are a one-line follow-up (deliberately 0 first pass).

[Generated by AI]

## Status — build landed, visual pass owed Per map convention (build session closed, defect/polish work continues on the same branch): the #77 parity build landed as follow-up commits on `wayfinder/76-apex-html-reading` @ **8fe5f48** (feature) + **3934b10** (DOX), local, unpushed. **What landed** (`Museion/ProsePresenter.swift` rewritten, `ProseTypography.swift` extended, `ProsePresenterTests.swift` new): - Leading: calibrated to reading's CSS 1.8 via font metrics (`17pt × 1.8 / natural box`), not the raw CSS number — TextKit's `lineHeightMultiple` multiplies the font's natural box (~1.2×), copying 1.8 verbatim would overshoot ~20%. The old 1.5 constant happened to sit near CSS-1.8's true value; the calibration makes the parity exact and self-documenting. - Heading ladder: h1 26→30, h2 20→22 (Concourse Semibold), new h3 kind (`### `, 19pt body-face bold ≈ CSS w600), h4+ bold body. Marker hashes dim. - Blank source lines: 9pt half-height separators (Alexander's pick). - Quotes: secondary ink #48484d + 20pt indent (firstLineHeadIndent + headIndent), marker dim. - Fence interiors: mono-14 ink on substrate tint; delimiters dim (fence-state scan of the document prefix feeds per-paragraph `reattribute`). - List markers (`- `, `1. `, nested): dim. - Inline traits: `**bold**` bold, `_italic_` italic (CommonMark intraword-underscore never emphasizes — `file_name_here` stays plain), `` `code` `` mono-14, link labels ink + muted underline with brackets/URL dim. Marks stay visible-dimmed everywhere (plain store is the source of truth). - Tables stay plain body (ruled: booktabs is impossible in a source view). **Verification**: 103 unit tests green (11 new pinning ladder/blanks/quote/fence/traits/intraword rule), lint 0 errors (warnings at the neighbors' tolerated level), SwiftFormat clean, GitNexus graph check run (high risk = the presenter is the editor's core styling path; affected flows are exactly the two intended: load + per-paragraph reattribute). **Owed**: Alexander's visual pass in-app (done condition). The launch + capture path was blocked by a dead screen-capture instrument (all screenshots black while the app process and its window are verified alive via CGWindowList — the known wallpaper-capture trap; not an app defect). App is built and launched from `wayfinder/76-apex-html-reading` tip. Read kitchen-sink + the calibration piece in the editor; if spacing feels tight, heading paragraphSpacing values are a one-line follow-up (deliberately 0 first pass). [Generated by AI]
Author
Owner

Follow-up (Alexander, same session): editor measure set to reading parity — 66ch via zero-glyph advance in the body face + 2×24pt padding, text centered when the column is wider (scroll view still fills). Heading spacing landed: 75pt before / 30pt after (CSS 90/30 minus the visible blank separator's ~15pt). Branch tip 4644143; app relaunched for the visual pass.

[Generated by AI]

Follow-up (Alexander, same session): editor measure set to reading parity — 66ch via zero-glyph advance in the body face + 2×24pt padding, text centered when the column is wider (scroll view still fills). Heading spacing landed: 75pt before / 30pt after (CSS 90/30 minus the visible blank separator's ~15pt). Branch tip 4644143; app relaunched for the visual pass. [Generated by AI]
Author
Owner

Branch note: wayfinder/76-apex-html-reading was merged into main (merge fefdd9a, mid-session) and deleted; the later follow-ups — 66ch measure + heading spacing (4644143), overlay scrollbar (ffb80be), audit fixes incl. the fence-delimiter staleness fix (1f7557a), session log (49fab56) — landed on main directly. main @ 49fab56 is pushed and is the build to calibrate. Still owed: Alexander's visual pass (kitchen-sink + calibration piece in the editor).

[Generated by AI]

Branch note: `wayfinder/76-apex-html-reading` was merged into `main` (merge `fefdd9a`, mid-session) and deleted; the later follow-ups — 66ch measure + heading spacing (`4644143`), overlay scrollbar (`ffb80be`), audit fixes incl. the fence-delimiter staleness fix (`1f7557a`), session log (`49fab56`) — landed on `main` directly. `main` @ `49fab56` is pushed and is the build to calibrate. Still owed: Alexander's visual pass (kitchen-sink + calibration piece in the editor). [Generated by AI]
Author
Owner

Resolution

Landed on main @ 49fab56 (pushed). The editing surface now mirrors the calm-ruled reading surface (#78) — scope expanded from the original line-spacing defect to full writing-surface parity (Alexander, live: "as close as possible to the reading side, but with plain Markdown").

What landed:

  • Heading ladder h1 30 / h2 22 / h3 19 body-face-bold / h4+ bold body; markers dim
  • Leading calibrated to CSS 1.8 via font metrics (per-kind: body 1.8, headings 1.15, code 1.5 — TextKit's lineHeightMultiple multiplies the natural box, so the CSS number is converted, not copied)
  • Inline traits: **bold**, _italic_ (CommonMark intraword-_ rule), `code`, link labels ink + underline; marks stay visible-dimmed (plain store = source of truth)
  • Quotes secondary-ink + 20pt indent; fence interiors mono-14 on substrate; list markers dim; blank separators at half height (9pt)
  • 66ch editor measure (zero-glyph × 66 + padding, centered in wide columns); heading spacing 75/30; overlay scrollbar
  • Reviewer-fanout fixes (1f7557a): fence-delimiter-edit staleness (delimiter-count fingerprint → full re-attribute), font caching, CommonMark 6-hash cap, misc shrink (−55 lines)

Verification: 104 tests green (12 new ProsePresenterTests pinning ladder/blanks/quote/fence/traits/intraword/calibration/delimiter-count), SwiftFormat + SwiftLint clean, GitNexus graph-checked. HITL: Alexander approved the visual pass (2026-10-08) — done.

Deviation note: the ticket's branch wayfinder/76-apex-html-reading was merged to main mid-session (fefdd9a) and deleted; follow-ups landed on main directly. Tables stay plain body (ruled: booktabs is impossible in a source view).

[Generated by AI]

## Resolution **Landed on `main` @ `49fab56` (pushed).** The editing surface now mirrors the calm-ruled reading surface (#78) — scope expanded from the original line-spacing defect to full writing-surface parity (Alexander, live: "as close as possible to the reading side, but with plain Markdown"). What landed: - Heading ladder h1 30 / h2 22 / h3 19 body-face-bold / h4+ bold body; markers dim - Leading calibrated to CSS 1.8 via font metrics (per-kind: body 1.8, headings 1.15, code 1.5 — TextKit's `lineHeightMultiple` multiplies the natural box, so the CSS number is converted, not copied) - Inline traits: `**bold**`, `_italic_` (CommonMark intraword-`_` rule), `` `code` ``, link labels ink + underline; marks stay visible-dimmed (plain store = source of truth) - Quotes secondary-ink + 20pt indent; fence interiors mono-14 on substrate; list markers dim; blank separators at half height (9pt) - 66ch editor measure (zero-glyph × 66 + padding, centered in wide columns); heading spacing 75/30; overlay scrollbar - Reviewer-fanout fixes (`1f7557a`): fence-delimiter-edit staleness (delimiter-count fingerprint → full re-attribute), font caching, CommonMark 6-hash cap, misc shrink (−55 lines) **Verification:** 104 tests green (12 new `ProsePresenterTests` pinning ladder/blanks/quote/fence/traits/intraword/calibration/delimiter-count), SwiftFormat + SwiftLint clean, GitNexus graph-checked. **HITL: Alexander approved the visual pass (2026-10-08) — done.** Deviation note: the ticket's branch `wayfinder/76-apex-html-reading` was merged to `main` mid-session (`fefdd9a`) and deleted; follow-ups landed on main directly. Tables stay plain body (ruled: booktabs is impossible in a source view). [Generated by AI]
Author
Owner

Input from the Neo triage (map #79, 2026-10-08):

  • On-demand spellcheck posture (Neo: spellcheck off by default, on when asked): an input for the editing-parity surface. Not a ticket — markdown on disk already carries spelling; it's a posture question for how the editor presents it.

[Generated by AI]

Input from the Neo triage (map [#79](https://git.babylondreams.de/AlexKucera/museion/issues/79), 2026-10-08): - **On-demand spellcheck posture** (Neo: spellcheck off by default, on when asked): an input for the editing-parity surface. Not a ticket — markdown on disk already carries spelling; it's a posture question for how the editor presents it. [Generated by AI]
Author
Owner

Followup resolved — spellcheck posture

Landed on main @ c1f5d70 (pushed). The Neo triage input (spellcheck off by default, on when asked) is implemented:

  • AppGateState.spellChecking (default false, per-launch, no persistence — markdown on disk carries the spelling)
  • Edit ▸ Check Spelling While Typing (EditSpellingToggle; commands views take gate as a plain property — @Environment lookups trap at launch there, crash-verified)
  • applied to the live NSTextView in makeNSView/updateNSView; build + 105 tests green; squiggles verified in-app (lldb flag read + screenshot: teh/quik/foxx/qwertyuiop underlined)

Ops note (cost ~1h of debugging): the first in-app test looked like a no-op because the machine had a system-wide kill switch — NSAllowContinuousSpellChecking = 0 in the global defaults domain makes the NSTextView setter a silent no-op in every app (TextEdit included, spelling panel empty). Deleted via defaults delete -g NSAllowContinuousSpellChecking; after that the feature worked everywhere, no app code change needed for that part. If squiggles ever die again machine-wide, check that key first.

[Generated by AI]

## Followup resolved — spellcheck posture **Landed on main @ c1f5d70 (pushed).** The Neo triage input (spellcheck off by default, on when asked) is implemented: - `AppGateState.spellChecking` (default false, per-launch, no persistence — markdown on disk carries the spelling) - Edit ▸ Check Spelling While Typing (`EditSpellingToggle`; commands views take `gate` as a plain property — `@Environment` lookups trap at launch there, crash-verified) - applied to the live NSTextView in `makeNSView`/`updateNSView`; build + 105 tests green; squiggles verified in-app (lldb flag read + screenshot: teh/quik/foxx/qwertyuiop underlined) **Ops note (cost ~1h of debugging):** the first in-app test looked like a no-op because the *machine* had a system-wide kill switch — `NSAllowContinuousSpellChecking = 0` in the global defaults domain makes the NSTextView setter a silent no-op in every app (TextEdit included, spelling panel empty). Deleted via `defaults delete -g NSAllowContinuousSpellChecking`; after that the feature worked everywhere, no app code change needed for that part. If squiggles ever die again machine-wide, check that key first. [Generated by AI]
Sign in to join this conversation.