brokenOn static method

TextSpan brokenOn(
  1. InlineSpan source,
  2. List<(int, int)> opp,
  3. List<int> cuts
)

source broken on cuts of opp as cuts returns them: a line feed where each line but the last ends, the space the break eats dropped, every style kept. source is text alone, as cuts was asked about it.

Implementation

static TextSpan brokenOn(InlineSpan source, List<(int, int)> opp, List<int> cuts) {
  // A line ends before the character a cut names, and the space a cut
  // eats is dropped.
  return _brokenAt(source, {
    for (var t = cuts.length - 1; t > 1; t--) opp[cuts[t - 1] - 1].$1: opp[cuts[t - 1] - 1].$2,
  });
}