setChar method

void setChar(
  1. int x,
  2. int y,
  3. String char, {
  4. Style style = Style.none,
  5. int width = 1,
})

Implementation

void setChar(int x, int y, String char,
    {Style style = Style.none, int width = 1}) {
  assert(
      width == 1 || width == 2, 'setChar width must be 1 or 2 (got $width)');

  if (!_inBounds(x, y)) {
    return;
  }

  _cleanupOrphan(x, y);
  if (width > 1) {
    for (var i = 1; i < width; i++) {
      _cleanupOrphan(x + i, y);
    }
  }
  _cells[y * this.width + x] = Cell(char: char, style: style, width: width);
  if (width > 1) {
    for (var i = 1; i < width; i++) {
      if (_inBounds(x + i, y)) {
        _cells[y * this.width + x + i] = Cell.continuation;
      }
    }
  }
}