Skip to content

Spec 001 T030 follow-up: long-token breaks - #164

Merged
adamjohnwright merged 4 commits into
mainfrom
layout/break-lows-2
Nov 4, 2026
Merged

adamjohnwright merged 4 commits into
mainfrom
layout/break-lows-2

Conversation

@adamjohnwright

Copy link
Copy Markdown
Contributor

Spec 001, a follow-up to T030 (#162). Replaces #163 after its review (two mediums, fixed in the second-last commit).

  • Which spaces end a token is now the set Chromium was measured to break a line at (ci/measure/breaks.ts, which fails if the code disagrees): tab, LF, CR, space, U+1680, U+2000–U+2006, U+2008–U+200B, U+2028, U+2029, U+205F, U+3000, and numeric references to them. No-break, figure, narrow no-break and zero-width no-break spaces, vertical tab and form feed join their neighbours. Spec 001 T030 follow-up: long-token breaks #163 had dropped the Unicode breakable spaces, so words beside a thin space were broken mid-word; 9 human summations in release 98 hold such spaces.
  • A word split by inline tags is counted whole (summations read with their own tag scanner, which relies on sanitiseSummation, now asserted for every built summation); long tokens are broken into even pieces of 13 to 20.
  • What can still overflow is measured by the same script and given as approximate in contracts/cli.md and research R8.

Tests: test/layout/html.test.ts; 452 in all. Mutants in tasks.md.

🤖 Generated with Claude Code

adamjohnwright and others added 4 commits November 4, 2026 04:15
A token no longer ends at a no-break space, U+202F or U+FEFF, which
Chromium does not break at (the spaces it does break at are measured and
listed in the next commit). A summation's markup is read whole, so a word
runs through inline tags and is counted whole; tags are never counted or
broken into. A token over 40 breaks into equal pieces of at most 20. Unit
tests for text() and markupBreaks, each shown failing with its mutant. The
docs say what can still overflow (re-measured in the next commit).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sured

A token now ends at every space Chromium was measured to break a line at:
tab, line feed, carriage return, space, U+1680, U+2000 to U+2006, U+2008
to U+200B, U+2028, U+2029, U+205F and U+3000, and a numeric reference to
one. #163 ended tokens at space, tab, line feed and carriage return alone,
so two words beside a thin space counted as one token and a long pair
broke mid-word. A no-break space, U+2007, U+202F, U+FEFF, U+000B and
U+000C still join their neighbours.

ci/measure/breaks.ts measures both what Chromium breaks at (exit 1 where
BREAKABLE_SPACE disagrees) and how many columns of tokens of each length
are wider than the text column; its output is recorded, and the docs give
its figures as approximate, the letters and the method stated.

markupBreaks says it relies on sanitiseSummation; tests cover the tag
reader's quoted attributes, comments, a and b, upper case, raw markup
through the sanitiser, and every built summation sanitised.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adamjohnwright
adamjohnwright merged commit 25524b5 into main Nov 4, 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