Skip to content

M0: scaffold and spikes - #2

Merged
samitbasu merged 1 commit into
mainfrom
m0-scaffold
Nov 7, 2026
Merged

samitbasu merged 1 commit into
mainfrom
m0-scaffold

Conversation

@samitbasu

Copy link
Copy Markdown
Owner

Part of #1.

Sets up the crate and CI, and proves the egui and taffy spikes the plan depends on. Each spike ends in a passing test. Nothing draws yet.

What's here

  • Cargo.toml:
    • edition 2024, rust-version 1.96
    • taffy 0.15.1, egui 0.37
    • dev-dependencies: eframe, egui_kittest, and egui with default_fonts
  • CI (.github/workflows/ci.yml): fmt, clippy -D warnings, tests, doctests, and rustdoc -D warnings.
  • docs/design.md (the design brief) and CLAUDE.md, both verbatim.
  • src/measure.rs: the taffy measure adapter, which measures text with egui galleys, plus its tests and the exit test.
  • src/spikes.rs (test-only): child Ui identity, text overrides, headless kittest, and the focus query.

Findings

  • taffy measure: the callback is compute_layout_with_measure(node, avail, |LayoutInput, NodeId, Option<&mut Ctx>, &Style| -> LayoutOutput).

    • MaxContent gives the single-line width.
    • MinContent gives the exact width of the widest word. A galley wrapped at that width comes out slightly wider than the word itself, so the adapter reports the word's width.
    • A known or definite width wraps the text at that width.
  • Baselines work. The first baseline is row.pos.y + glyph.pos.y, returned in LayoutOutput.baselines.first. This means items_baseline is feasible.

  • egui 0.37 renames:

    • UiBuilder::id → UiBuilder::scope_id
    • Ui::id → Ui::scope_id
    • Id::new is deprecated, replaced by Id::unique or IdSalt
    • Context::run → run_ui / run_pass, and the returned FullOutput must be explicitly dropped with drop_without_applying_deltas

    The brief's D12 maps to scope_id. A test shows the child's id is the same under any parent.

  • Text overrides: visuals.override_text_color and style.override_font_id both reach a Label inside a child scope.

  • Fonts: egui 0.37 has default = []. The library depends on plain egui, so it stays neutral. Tests enable default_fonts. Applications get fonts through eframe.

  • Focus: ctx.memory(|m| m.focused()). Ids are hashes with no hierarchy, so the virtual-list pinned rows (M8) must track which widget ids belong to which row.

  • kittest: runs headless under cargo test. Snapshots (the snapshot and wgpu features) work on the dev machine. They are kept out of CI for now.

  • MinContent cost for a 50-word paragraph, in release: 627 µs cold, 5.8 µs warm (galley cache hit).

🤖 Generated with Claude Code

https://claude.ai/code/session_01PWiKKe8zfqGfVMCSC5L3up

Adds the bullseye crate skeleton (edition 2024, MSRV 1.96), CI (fmt,
clippy -D warnings, tests, doctests, rustdoc -D warnings), the design
brief as docs/design.md and CLAUDE.md, so later milestones build on
checked ground.

Spikes, each a passing test written to be kept by M1:
- measure.rs: taffy measure adapter over egui galleys (max-content,
  min-content = widest word, height-for-width, both-known passthrough,
  first baseline). The min-content width is the exact widest-word width,
  because a galley wrapped at that width can come out slightly wider.
- spikes.rs: child Ui identity via UiBuilder::scope_id, text colour and
  font overrides on a child Ui, headless egui_kittest, and the focused
  widget id query.
- Exit test: "Hello" in an 800x600 centred flex container has the
  measured size and is centred.

egui is a dev-dependency with default_fonts: egui 0.37 has no default
features, so fonts must be enabled explicitly for measurement tests.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PWiKKe8zfqGfVMCSC5L3up
@samitbasu
samitbasu merged commit 9f9f073 into main Nov 7, 2026
2 checks passed
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