feat(desktop): adjustable font weight and line height (terminal, editor, chat)

Closed
RO
4mo ago
+1906-14

What

Adds two new appearance controls — font weight (100–900) and line height (1–3) — to the Terminal and Editor font settings, alongside the existing family/size controls. They persist in local-db and apply live across all three text surfaces of the desktop app:

SurfaceHow it's applied
Terminal (xterm) — incl. Claude Code & other CLI agentsNative xterm fontWeight + lineHeight options, on create and on live appearance updates (both the v1 cache and v2 runtime paths)
Editor + diff viewer (CodeMirror / Pierre)fontWeight on the host; line height computed as fontSize * multiplier, replacing the previously hardcoded *1.5
Markdown / chat proseBody line-height + base font-weight follow the Editor settings via CSS variables; headings and bold text keep their own weights/line-heights

Why

The only adjustable typography today is family + size. Users want denser or more breathable text and lighter/heavier weights — especially in the terminal, where Claude Code and other agents run.

Notes

  • No behavior change when unset. Each surface keeps its existing default (terminal weight 400 / line-height 1.0; editor weight 400 / line-height 1.5; markdown styles keep their tuned defaults). The markdown CSS variables are only set when the user has an explicit override.
  • Markdown prose intentionally tracks the Editor settings rather than introducing a third settings group; bold/heading semantics are preserved because those elements declare their own weights.
  • The diff viewer (Pierre) has no --diffs-font-weight variable, so weight is set on the host element — non-bold (inheriting) tokens pick it up while keyword/emphasis token weights from the syntax theme stay intact.
  • local-db migration 0042_add_font_weight_line_height adds four nullable columns (generated via drizzle-kit generate).

Testing

  • bun run typecheck (desktop + local-db) — pass
  • bun run lint — clean (0)
  • bun test for font-settings, terminal font-settle / ws-transport — pass; extended font-settings.test.ts with weight/line-height validation + transform cases (32 tests pass)

Open in Stage

Summary by cubic

Add adjustable font weight (100–900) and line height (1–3) to Terminal, Editor, and chat/markdown. Values persist in local-db, apply live across terminal runtime, editor/diff viewer, and markdown, and keep existing defaults when unset.

  • New Features

    • Terminal: native fontWeight/lineHeight on create and live updates; defaults 400 / 1.0.
    • Editor + diff viewer: host fontWeight; line height = fontSize × multiplier (replaces fixed 1.5); syntax token weights unchanged; diff viewer sets --diffs-line-height and host weight.
    • Chat/Markdown: prose follows editor via CSS vars (--md-font-weight, --md-line-height) with fallbacks; headings/bold unchanged.
    • Settings: new weight/line-height inputs with validation (100–900 int, 1–3), rounds weight to nearest 100 on blur, live preview; tests cover bounds and passthrough.
  • Migration

    • 0042_add_font_weight_line_height adds four nullable settings columns (terminal/editor weight and line height). No action needed.

Summary by CodeRabbit

  • New Features

    • Font weight (100–900) and line-height (1–3) are now configurable for editor, terminal, and markdown, with per-component overrides and persisted settings.
    • Settings UI: numeric inputs, live preview, and reset behavior for weight and line-height.
  • Style

    • Markdown and theme styles now honor font-weight and line-height via CSS variables.
  • Tests

    • Added validation and transformation tests covering bounds, fractional/nullable values, and edge cases.