fix(typed-pages): start pages that open with a title where plain text starts #55

Merged
jfro merged 2 commits from fix/18-typed-page-margins into main 2026-10-27 02:45:23 +00:00
Owner

Closes #18

Why pages with a title sat low

A typed title's line box is 150 tall, plain text's 70 (measured 2026-10-15, docs/verification.md). The page file only carries pos_y, and from the same pos_y the tablet puts a title's baseline 80 lower than a plain line's. So every page that opens with # Title started ~80px (≈4% of the page) lower than one that opens with text, on every template.

The fix

  • Lines.Writer.text_page/3 raises pos_y by the first paragraph's extra lead (Lines.Text.first_line_lead/1: title 80, subheading 17.6, plain 0), clamped at the page top. The first line's baseline now lands 18 above the layout's pos_y whatever its style.
  • priv/typed_page_layouts.json: Lines small pos_y 133.5 → 213.5. It was tuned on the dev page's sample, which starts with a title, so title-first pages land exactly where you tuned them; plain-first pages on Lines small now match them (they used to sit 80 higher).
  • Untuned templates (Blank etc., default pos_y 234): a title-first page's title baseline moves from y≈296 to y≈216, where the tablet starts plain typed text.
  • /dev/typed-pages draws its text box and pink start guide at the pos_y actually written, and says when it's been raised.
  • docs/typed-pages.md updated.

Tests

  • New writer tests: title- and subheading-first pages put their first baseline where a plain-first page does; a raised pos_y never goes above 0. Both fail on main.
  • mix precommit: 909 passed.

Checking it on the tablet

  1. Run this branch, open /dev/typed-pages, pick a notebook on a template you use (try Blank and P Lines small).
  2. Leave the sample as is (it starts with # Offsite planning summary) and click Add to notebook; then change the sample's first line to plain text and add it again.
  3. After sync, on the tablet: the title should sit about 80px higher than before on Blank, and the two pages' first lines should start at the same height. If it's still lower than you write, nudge Start down on that template and Save; that's now a per-template preference rather than a title penalty.
Closes #18 ## Why pages with a title sat low A typed title's line box is 150 tall, plain text's 70 (measured 2026-10-15, docs/verification.md). The page file only carries `pos_y`, and from the same `pos_y` the tablet puts a title's baseline 80 lower than a plain line's. So every page that opens with `# Title` started ~80px (≈4% of the page) lower than one that opens with text, on every template. ## The fix - `Lines.Writer.text_page/3` raises `pos_y` by the first paragraph's extra lead (`Lines.Text.first_line_lead/1`: title 80, subheading 17.6, plain 0), clamped at the page top. The first line's baseline now lands 18 above the layout's `pos_y` whatever its style. - `priv/typed_page_layouts.json`: Lines small `pos_y` 133.5 → 213.5. It was tuned on the dev page's sample, which starts with a title, so title-first pages land exactly where you tuned them; plain-first pages on Lines small now match them (they used to sit 80 higher). - Untuned templates (Blank etc., default `pos_y` 234): a title-first page's title baseline moves from y≈296 to y≈216, where the tablet starts plain typed text. - `/dev/typed-pages` draws its text box and pink start guide at the `pos_y` actually written, and says when it's been raised. - docs/typed-pages.md updated. ## Tests - New writer tests: title- and subheading-first pages put their first baseline where a plain-first page does; a raised `pos_y` never goes above 0. Both fail on main. - `mix precommit`: 909 passed. ## Checking it on the tablet 1. Run this branch, open `/dev/typed-pages`, pick a notebook on a template you use (try Blank and P Lines small). 2. Leave the sample as is (it starts with `# Offsite planning summary`) and click **Add to notebook**; then change the sample's first line to plain text and add it again. 3. After sync, on the tablet: the title should sit about 80px higher than before on Blank, and the two pages' first lines should start at the same height. If it's still lower than you write, nudge Start down on that template and Save; that's now a per-template preference rather than a title penalty.
fix(typed-pages): start pages that open with a title where plain text starts
All checks were successful
CI / test (pull_request) Successful in 1m27s
a3230a41cc
A title's line box is 150 tall to plain text's 70, so from the same pos_y
the tablet put a title-first page's text ~80 lower. The writer now raises
pos_y by the first line's extra lead, so the first baseline lands in the
same place whatever its style. Lines small's tuned pos_y moves to 213.5 so
its title-first pages stay where they were tuned.

Closes #18
jfro added this to the v1.6.0 milestone 2026-10-27 01:20:17 +00:00
fix(typed-pages): keep Lines small's tuned pos_y at 133.5
All checks were successful
CI / test (pull_request) Successful in 1m27s
8ed923ae3f
jfro merged commit 63f99325c8 into main 2026-10-27 02:45:23 +00:00
jfro deleted branch fix/18-typed-page-margins 2026-10-27 02:45:23 +00:00
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
jfro/rm-analyzer!55
No description provided.