fillArea method
Fills the buffer with cell within area.
Note: we step by cell width to avoid repeatedly overwriting wide-cell placeholders.
Upstream: third_party/ultraviolet/buffer.go (FillArea).
Implementation
void fillArea(Cell? cell, Rectangle area) {
final opaqueSingleWidth =
(cell == null || !_hasTranslucentOverlay(cell.style)) &&
(cell == null || cell.width <= 1);
if (opaqueSingleWidth) {
final fillCell = cell ?? Cell.emptyCell();
for (var y = area.minY; y < area.maxY; y++) {
touchLine(area.minX, y, area.width);
for (var x = area.minX; x < area.maxX; x++) {
lines[y].replaceWithClone(x, fillCell);
}
}
return;
}
var cellWidth = 1;
if (cell.width > 1) cellWidth = cell.width;
for (var y = area.minY; y < area.maxY; y++) {
for (var x = area.minX; x < area.maxX; x += cellWidth) {
setCell(x, y, cell);
}
}
}