draw method

  1. @override
void draw(
  1. Screen screen,
  2. Rectangle area
)

Draws this styled string into screen inside area, clearing first.

Implementation

@override
/// Draws this styled string into [screen] inside [area], clearing first.
void draw(Screen screen, Rectangle area) {
  // Clear the area before drawing.
  for (var y = area.minY; y < area.maxY; y++) {
    for (var x = area.minX; x < area.maxX; x++) {
      screen.setCell(x, y, null);
    }
  }

  // Normalize CRLF to NL to emulate raw terminal output.
  final normalized = text.replaceAll('\r\n', '\n');
  final expanded = term_ansi.Ansi.expandTabs(normalized);

  _printString(
    screen,
    WidthMethod.grapheme,
    area.minX,
    area.minY,
    area,
    expanded,
    truncate: !wrap,
    tail: tail,
  );
}