Buffer.fromLines constructor
Creates a new buffer from the given lines
.
Implementation
factory Buffer.fromLines(Iterable<Line> lines) {
final lines_ = List.of(lines);
final height = lines_.length;
final width = lines_.fold(0, (width, line) => math.max(width, line.width));
final buffer = Buffer(width, height);
for (var y = 0; y < height; y++) {
buffer.setLine(0, y, lines_.elementAt(y));
}
return buffer;
}