Skip to content

Milestone 3: sizes, jump labels and :sym - #3

Merged
y0sif merged 12 commits into
mainfrom
feat/m3-sizes-jumps
Oct 24, 2026
Merged

y0sif merged 12 commits into
mainfrom
feat/m3-sizes-jumps

Conversation

@y0sif

@y0sif y0sif commented Oct 24, 2026

Copy link
Copy Markdown
Owner

What

  • Sizes (lawh-core, lawh-render): text and math take a size from 0.25 to 16. <C-a> and <C-x> step it, :si N, :si +N and :si -N set it, :set size=N sizes new blocks, and :te ++size=N / :ma ++size=N make a sized block. Files get an optional size=, written only when not 1, so the header stays version=1 and M2 boards round-trip byte for byte.
  • Math matches text: math is drawn at MATH_SCALE = 1.2725, so at the same size its x-height is within 3% of text's and a one-line formula sits on the text baseline.
  • Jump labels: s puts a one- or two-character label on every other object in view. A label moves the cursor, stretches a Visual selection, or after d/y acts on that object while the cursor stays. . asks for a label again. :set jumplabels= sets the characters, and label keys skip mappings.
  • :sym: fuzzy search over Typst's symbol names (nucleo-matcher), with the list built in lawh-math from codex and passed into the engine. 457 of 1,189 symbols are hidden because the bundled fonts can't draw them. <C-k> in Insert mode opens it: math gets the name, text gets the character, the board gets a new math block.
  • Inside blocks: W, B and E move by space-separated words.
  • App: labels follow the view; :w to the board's own file under another path (~, absolute, a link) counts as saving it, checked by file identity.
  • Caps: every new key charges the per-key work budget, real text layout included (Measure::take_work). New limits are listed in CLAUDE.md.
  • Leftovers: format_proptest reads LAWH_PROPTEST_CASES; bench.yml runs the key-cost measurements.
  • Docs: docs/keys.md, the architecture, testing, tech-stack and security docs, and M3 measurements.

Result

examples/area.lawh still takes 62 keys, and its formula now matches the text.

Checks

  • Locally: fmt, clippy -D warnings, 834 tests, the Rust 1.95 check and cargo-deny all pass.
  • Tested by hand on Linux (Hyprland, Wayland). Not tried on macOS or Windows.

🤖 Generated with Claude Code

y0sif and others added 12 commits October 12, 2026 10:31
- Shape::Text and Shape::Math carry a size (multiplier, default 1, 0.25..=16), refused
  out of range by the board and the reader.
- The writer adds size= after x y only when it isn't 1, so boards without sizes write
  back byte-identical.
- FixedMeasure scales with size; moving or typing into a block keeps its size.
- format_proptest reads LAWH_PROPTEST_CASES.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LbT1KUQukgkZNgWh8f8U7i
… writes

- <C-a>/<C-x> step a text or math block along SIZE_STEPS, with counts, . and one undo
  step; in Visual mode they resize the selection.
- :si N, :si +N, :si -N on the current object or the selection; :set size for new
  blocks; :te/:ma ++size=N; o/O keep a block's size.
- W B E in block-Normal mode.
- write_done takes same_file, so a write the app finds is the board's own file saves it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LbT1KUQukgkZNgWh8f8U7i
- s in Normal mode, Visual mode and after d/y labels every object in view, nearest first,
  one character for the nearest and two for the rest, prefix-free.
- A label moves the cursor, stretches a Visual rectangle, or acts remotely after d/y with
  the cursor staying put; . asks for a new label.
- Label keys skip key maps; Esc, Backspace, an unmatched key and a click cancel.
- :set jumplabels, Engine::set_view, measured LABEL_WORK and PICK_WORK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LbT1KUQukgkZNgWh8f8U7i
- :sym query lists the best 8 matching symbols (nucleo-matcher), Tab/C-n and
  S-Tab/C-p cycle, Enter picks: the Typst name in math (spaced from names it would
  touch), the character in text, a new math block on the board.
- Ctrl+K in Insert mode opens :sym and comes back after the pick; . types what was
  inserted.
- The symbol list is passed in (Engine::set_symbols), so lawh-core stays free of
  Typst. Caps MAX_SYMBOLS, MAX_SYM_QUERY_CHARS, SYM_ROWS; measured work weights.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LbT1KUQukgkZNgWh8f8U7i
symbols() lists codex's names (pinned to Typst's version) with their values, marks
which the bundled fonts can draw, and sorts them in the engine's order. A test compiles
every name and checks the flag against the layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LbT1KUQukgkZNgWh8f8U7i
- Text, math, bounds, carets and hit tests follow each block's size.
- Math is drawn MATH_SCALE (1.2725, the fonts' x-height ratio) larger, its first baseline
  on the text baseline.
- Jump labels: small boxes on object anchors, clamped to the window, nearest on top,
  the typed prefix dimmed.
- :sym rows above the status line, the selected row highlighted; the status font falls
  back to Libertinus Math.
- New goldens; regenerated goldens for the bigger math; bench cases for 500 labels and
  8 completion rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LbT1KUQukgkZNgWh8f8U7i
… by identity

- The engine gets the visible board area before every key and timeout, so jump labels
  cover what is on screen.
- The drawable Typst symbols go to the engine once at start (not in the math worker).
- After a good write, the app compares file identity (device and inode on Unix,
  canonical paths elsewhere), so :w ~/x.lawh of the board's own file saves it.
- bench.yml runs the engine cost measurements and the symbol list measurement.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LbT1KUQukgkZNgWh8f8U7i
…ew findings

- Measure::take_work reports layout work; the renderer converts its layout estimate
  for cache misses (KEY_WORK_PER_LAYOUT_NS) and the engine charges it after every
  measure. A mapping over a long text stopped after 2 to 6 s; it now stops in about
  0.1 s (release).
- :sym refuses an over-long query before copying it, and charges line copies.
- Visual d/y/x/:si after a resize act on what is highlighted.
- Board text falls back to Libertinus Math for characters Inter lacks (liga off), so
  symbols picked into text draw.
- Calibrations re-measure a failing row before failing; bench.yml runs measure_cost.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LbT1KUQukgkZNgWh8f8U7i
…e characters Inter lacks

- Each drawing row measures its empty frame once, so a re-measure can only lower the
  time taken, never the frame subtracted.
- The math-symbol text kind and the fallback tests use U+27FC and other arrows Inter
  lacks (U+27F6 is in Inter).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LbT1KUQukgkZNgWh8f8U7i
- keys.md: size keys and commands, jump labels, :sym and Ctrl+K, W B E, new options.
- architecture.md: size in the format and drawing, math scale and baseline, font
  fallback, the engine's labels and symbol search, measured layout work, same-file
  writes, overlay and limits.
- testing.md, tech-stack.md, CLAUDE.md, README.md, SECURITY.md updated; new
  docs/research/m3-measurements.md; examples/lawhrc gets a jumplabels line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LbT1KUQukgkZNgWh8f8U7i
Measured run-out times per case, @: after a Visual :si, sources for the flash.nvim
default, glosses, the baseline tolerance, and the worst open time since the font
fallback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LbT1KUQukgkZNgWh8f8U7i
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@y0sif
y0sif merged commit d9ee554 into main Oct 24, 2026
4 checks passed
@y0sif
y0sif deleted the feat/m3-sizes-jumps branch October 25, 2026 17:00
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