size property
Retrieves the current dimensions (width and height) of the terminal.
Implementation
Future<Point<int>> get size async {
final termPoint = backend.size;
if (termPoint != const Point(-1, -1)) {
return termPoint;
}
try {
var startPos = await cursorPosition();
backend.write('\x1b[900;900H');
final bottomRight = await cursorPosition();
backend.write('\x1b[${startPos.y};${startPos.x}H');
return bottomRight;
} catch (_) {
return const Point(80, 24);
}
}