clearRegion method
Implementation
@override
void clearRegion(ClearType type) {
switch (type) {
case ClearType.all:
clear();
case ClearType.afterCursor:
for (var y = _cursorPos.y; y < _buffer.area.bottom; y++) {
for (var x = _cursorPos.x; x < _buffer.area.right; x++) {
_buffer.setCell(Position(x, y), Cell.empty);
}
}
case ClearType.beforeCursor:
for (var y = 0; y <= _cursorPos.y; y++) {
final maxX = y == _cursorPos.y ? _cursorPos.x + 1 : _buffer.area.right;
for (var x = 0; x < maxX; x++) {
_buffer.setCell(Position(x, y), Cell.empty);
}
}
case ClearType.currentLine:
for (var x = 0; x < _buffer.area.right; x++) {
_buffer.setCell(Position(x, _cursorPos.y), Cell.empty);
}
case ClearType.untilNewLine:
for (var x = _cursorPos.x; x < _buffer.area.right; x++) {
_buffer.setCell(Position(x, _cursorPos.y), Cell.empty);
}
}
}