writeString method
Writes styled text to the buffer starting at (x, y).
Newlines (\n) will wrap to y + 1 at the starting column x.
Any characters that fall out of bounds are clipped.
Implementation
@override
void writeString(int x, int y, String text, Style style) {
final startX = x;
var currentX = x;
var currentY = y;
for (final char in text.characters) {
if (char == '\n') {
currentX = startX;
currentY++;
continue;
}
if (_isInBounds(currentX, currentY)) {
currentX += _writeCharInBounds(currentX, currentY, char, style);
} else {
currentX += 1;
}
}
}