drawChar method

void drawChar(
  1. int column,
  2. int line,
  3. String char, {
  4. AnsiColorType? fg,
  5. AnsiColorType? bg,
  6. Set<FontStyle>? styles,
})

Draws a single character at position (column, line) with optional style.

If the character is whitespace, the style is cleared. Ignores drawing if coordinates are out of bounds.

Implementation

void drawChar(
  int column,
  int line,
  String char, {
  AnsiColorType? fg,
  AnsiColorType? bg,
  Set<FontStyle>? styles,
}) {
  if (column >= 0 && column < width && line >= 0 && line < height) {
    final Set<FontStyle> effectiveStyle = (char.trim().isEmpty)
        ? {}
        : (styles ?? {});
    _screenBuffer[line][column] = BufferCell(
      char: char,
      fg: fg,
      bg: bg,
      styles: effectiveStyle,
    );
  }
}