renderStatusLine function

List<String> renderStatusLine(
  1. StatusLineSnapshot snapshot,
  2. StatusLineSpec spec,
  3. int width
)

The raw width-correct rows for one frame — the pure TuiStatusLine render output (tests pin these strings).

Implementation

List<String> renderStatusLine(
  StatusLineSnapshot snapshot,
  StatusLineSpec spec,
  int width,
) {
  final spans = renderStatusLineSpans(snapshot, spec, width);
  if (spans.isEmpty) return const [];
  final line = spans.map((s) => s.$1).join();
  // E1 invariant belt: the ladder is width-exact, but a pathological
  // single-huge-segment run truncates as the last resort.
  return [tuiTextWidth(line) > width ? tuiFitWidth(line, width) : line];
}