setCell method
Sets the cell at (x, y) and updates dirty tracking.
Implementation
void setCell(int x, int y, Cell? cell) {
if (y < 0 || y >= lines.length) return;
final current = cellAt(x, y);
final next = cell ?? Cell.emptyCell();
if (current == null || current != next) {
final w = next.width > 0 ? next.width : 1;
touchLine(x, y, w);
}
lines[y].set(x, cell);
}