setLine method
Sets cells starting at the given x
and y
coordinates to line
.
If maxWidth
is provided, the line will be truncated to fit within the
buffer's width, which otherwise defaults to the buffer's width if omitted.
Throws if the coordinates are out of bounds.
Implementation
void setLine(int x, int y, Line line, {int? maxWidth}) {
final width = maxWidth ?? this.width;
var i = 0;
for (final span in line.spans) {
final content = span.content;
final style = span.style;
print(
x + i,
y,
content,
maxWidth: width - x - i,
style: line.style.overrideWith(style),
);
i += content.characters.length;
}
}