feat(desktop): File tabs and a page's source follow View settings' type

Merged
DA
13d ago
+182-88

Summary

PR 1 of "one look for all code" (the developer chose that File tabs follow the Text settings too). This one covers the type. The syntax theme comes in PR 2.

  • The File tab and a page's source now set their lines in View settings' font, size, line height and ligatures.
    • useLinesLook reads them through useFileViewSettings, and CodeLinesView writes them as custom properties on .code-lines (--code-font, --code-font-size, --code-line-height, --code-font-features).
    • The stylesheet falls back to the window's code type where a box names none, as in the attachment viewer, which keeps its own look.
    • One default: at default settings the File tab is identical except for size. It drops from 12px (--luke-type-caption-size) to the diff's 11.5px, so diffs and files share one default. The font (SF Mono), line height (1.6) and ligatures (off) were already the same.
    • Changes apply live: the settings atom redraws the lines.
    • Ligatures apply to .code-line-text only, so a file note between the lines keeps its prose ligatures.
  • One table for diff and File tab: the font stacks, line-height ratios and ligature features moved out of the diff bundle into code-type.ts, which both read.
  • View settings on the File tab and page source gain a Text group: Font, Font size, Line height, Ligatures, under Lines.
    • There's no syntax theme row yet. The File tab is still coloured by the host's GitHub themes, so a theme row would be a setting that does nothing. PR 2 adds it.

Screenshots

Electron (xvfb). The harness draws a File tab's bar end over build.mjs's lines, with the runs coloured by the host's own highlightFile (GitHub themes), exactly as the File tab gets them. The colours survive a custom type: Courier New, 13px, Spacious, ligatures on.

lightdark
default, before (main, 12px)
default, after (11.5px)
default, after (full)
custom type
View settings

Evidence

  • file-view-menu.test.ts:
    • The File tab's View settings shows Lines and Text groups (Word wrap, Line numbers, Font, Font size, Line height, Ligatures) and no theme.
    • The drawn .code-lines carries today's defaults.
    • Turning Line numbers off and Ligatures on changes the drawn lines at once.
  • page-pane.test.ts: the page source's popover offers the same rows.
  • Local checks: 2423 panel, desktop and settings tests; tsc for panel and desktop; oxlint; biome; knip; repository-checks.

Made with Luke