8000 Task boxes T6b+T6c: natural widths, list slots, held lines and atoms by Asgarrrr · Pull Request #81 · Asgarrrr/inkra · GitHub
[go: up one dir, main page]

Skip to content

Task boxes T6b+T6c: natural widths, list slots, held lines and atoms - #81

Merged
Asgarrrr merged 72 commits into
mainfrom
task-boxes-t6c2
Nov 19, 2026
Merged

Asgarrrr merged 72 commits into
mainfrom
task-boxes-t6c2

Conversation

@Asgarrrr
Copy link
Copy Markdown
Owner

Context

Task boxes T6b, T6c1 and T6c2, per docs/superpowers/specs/2026-11-16-task-boxes-design.md. Follows #79 (T6a, merged); replaces #80, closed when its base branch was deleted. The merge commit 3ed04c8 takes main after #79's squash; its tree is identical to the verified head 0e0d2f2. T6b must not merge alone: with the real font, • is narrower than the box and text glues to it.

What changed

  • T6b, natural widths: a gutter slot takes its content's natural width.
  • T6c1, list slots: bullets and numbers sit in the box's slot; items nest by level; numbers right-align in one width per list (Markdown::width_keys, one shared vector, ItemPart::keys).
  • T6c2, held lines: an item's other lines (continuation, lazy, code) hang at its text. Code and HTML lines hide blanks only up to their leaf text (LeafText records, items/walk.rs).
  • Atoms (D2): the hidden blanks of a held line with no mark are one atom. Markdown::snap(offset, Bias) reaches inkra-editor as a closure, so the editor keeps no markdown dependency. The caret never rests inside an atom: after a move, after each parse, and when a saved selection comes back (swap_view). Backspace at a held line's text start joins the lines; on a quoted held line the atom covers the quote part (> - a\n> b joins to > - ab).
  • Marks on the baseline: LineLayout::text_metrics places a mark on its line's baseline, including an empty item.

How to verify

  • ./scripts/check.sh (exit 0 on 0e0d2f2).
  • cargo run -p inkra-app --features shot --example shot markdown-lists and markdown-lists-end, then look at target/shots/.
  • In the app: a list with continuation lines; ←, ⌫ at a held line's text start, clicks, a tab switch.
  • Mutants on git diff task-boxes-t6...: markdown 0 missed (2 expected walk timeouts), editor 0 missed, app misses only in shot/scenes builders.
  • Benches against task-boxes-t6b (ee87f1a): parse +2.25% median over 12 rounds (accepted, spec History); layout −4% to −8%.

Risk / rollback

  • Backspace at the start of a code line inside an item joins it to the line above, as at column 0 in any editor.
  • Word moves (⌥←, ⌥⌫) do not exist yet; they must go through the same snap when built.
  • A known older gap, recorded in the spec: - >```\n\t\t> gets no quote gutter on line 2, as on main.
  • Rollback: revert the squash commit; no data format changes.

The parse fills Markdown::structure in its one pulldown-cmark pass: the
items with their content start, the quotes, and the skipped lines, ATX
headings now among them. cycle_tasks reads it instead of its own passes
and marker grammar, offers - [ ] only where no item opens, reads such a
line through the fallback pass, and parses nothing for a batch of flips.
Markdown::task_at is the one task lookup; the app's hit test calls it,
and Measured and TaskBox carry a TaskShape.
The fallback takes the innermost item of its one-line pass, as an
opened line does, so a\n\t- - b under a new item nests its task again.
Structure.items holds marker starts only: cmd-L reads the one content
start it needs per line from the line's start, which keeps the column
carry out of the parse. The spec follows, with every thematic break of
- or * named, and its code locations rechecked.
A concealed task part takes its lead, then the box slot in the bullet's
place: the advance of the bullet and its space, or the box where wider.
A revealed one widens the gutter to its raw text, so its rows hang at
the raw end. The X measure goes; Measured never reads Reveal.
parse.rs stood at 390 of its 400 lines, and the gutter flag T6c1 adds to
Open would pass the limit (task boxes spec, slice 10).
scenes.rs stands at its line ceiling; the markdown-lists scene of T6c1
needs room beside them.
Room in scenes.rs, at its line ceiling, for the markdown-lists scene.
A gutter item's marker line gets an item part: one blank slot per
column of the items holding it, one slot per mark, then the box. Bullets
centre on the box's axis, numbers right-align in their list's width,
and a revealed item part paints raw, right-aligned, as its own piece.
pulldown-cmark's column counting decides each line's quotes, so a tab
after a quote's blank still leads the next one (M1).
Between two marker lines the walk visits each held line and hides its
blanks below the innermost item's hang column, so the line starts at the
item's text. A blank line takes no item part unless a code block holds it.
The code-block and quoted-task tests move from T6c1's interim values.
…name

Items::numbers becomes list_keys and ItemPart::numbers keys, so numbers names
only Marks' slot widths.
Blanks show nothing: revealing a held line's blanks only widened its part and
moved its text each time a caret touched it.
CoreText reports no ascent or descent for a line with no glyph, so an empty
item's mark painted half a row high.
The leaf text start replaces the span search and Out::text (D11), an item
part with no mark has no conceal (D2, D3), a mark's baseline comes from the
line's font metrics (D4); citations re-checked.
…no test could see it

A paragraph after a code block in an item and a blank line in an HTML comment
pin the leaf flag's end and the line-start record.
…etion takes it whole

Markdown::snap finds the atom by one binary search over gutters; EditorState's moves and
deletions take the host's snap, and EditorView snaps the selection after each new parse.
ItemPart::marked is the one predicate both the item conceal and the atom read.
< 8 div clas E178 s="AvatarStack flex-self-start " >
…; a quoted lazy line is no atom
…s after the swap

The review of 0227fbf: restore and a switch to another tab on the same note reset the
selection to saved offsets no snap had seen, so a letter typed there landed before the
hidden blanks. swap_view, the one sequence that resets the selection, now snaps against
the bound buffer's parse before the pin re-parks it.
# Conflicts:
#	crates/app/src/editor/layout/line.rs
#	crates/app/src/editor/layout/prefix/gutter.rs
#	crates/app/src/editor/layout/tests.rs
#	crates/markdown/src/cycle.rs
#	crates/markdown/src/gutters.rs
#	crates/markdown/src/parse.rs
#	crates/markdown/src/structure.rs
#	docs/superpowers/specs/2026-11-16-task-boxes-design.md
@Asgarrrr
Asgarrrr merged commit f2e7366 into main Nov 19, 2026
2 checks passed
@Asgarrrr
Asgarrrr deleted the task-boxes-t6c2 branch November 19, 2026 18:06
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

0