insertCellArea method
Inserts n cells at (x,y) within area (ansi ICH semantics).
Upstream: third_party/ultraviolet/buffer.go (InsertCellArea).
Implementation
void insertCellArea(int x, int y, int n, Cell? cell, Rectangle area) {
if (n <= 0 ||
y < area.minY ||
y >= area.maxY ||
y >= height() ||
x < area.minX ||
x >= area.maxX ||
x >= width()) {
return;
}
if (x + n > area.maxX) n = area.maxX - x;
for (var i = area.maxX - 1; i >= x + n && i - n >= area.minX; i--) {
lines[y].cells[i] = lines[y].cells[i - n].clone();
}
touchLine(x, y, n);
for (var i = x; i < x + n && i < area.maxX; i++) {
setCell(i, y, cell);
}
}