sceneTextRuns function

List<InlineSpan> sceneTextRuns(
  1. TextNode t
)

The spans a text node draws — its runs, each carrying only what it DIFFERS by, over the node's own style.

One span today, because a TextNode carries one string, and a list because it will not always: a run is a string with a style delta, and when text becomes several of them only this function changes. The renderer already asks for a list and already puts the node's style above it, so that change is to the model and the grammar, with no renderer work.

Implementation

List<InlineSpan> sceneTextRuns(TextNode t) => [
  for (var run in t.runs)
    TextSpan(
      text: t.textCase.apply(run.text),
      // Only what the run DIFFERS by: the renderer puts the node's style
      // above the list, and a span that repeated it would be a second
      // resolution of the same fields — the shape that made the ambient
      // style bug possible.
      style: run.style == null ? null : sceneRunStyle(run.style!),
    ),
];