insertLines method
void
insertLines(
- int count
)
Implementation
void insertLines(int count) {
if (!isInVerticalMargin) {
return;
}
setCursorX(0);
_invalidateCurrentLine();
// Number of lines from the cursor to the bottom of the scrollable region
// including the cursor itself.
final linesBelow = absoluteMarginBottom - absoluteCursorY + 1;
// Number of empty lines to insert.
final linesToInsert = min(count, linesBelow);
// Number of lines to move up.
final linesToMove = linesBelow - linesToInsert;
for (var i = 0; i < linesToMove; i++) {
final index = absoluteMarginBottom - i;
lines[index] = lines.swap(index - linesToInsert, _newEmptyLine());
}
for (var i = linesToMove; i < linesToInsert; i++) {
lines[absoluteCursorY + i] = _newEmptyLine();
}
}