drainHistoryScroll method
Waits until no history scroll flush is scheduled, in flight, or pending. Wired to TerminalEngine.onDrainHistoryScroll for absolute scroll paths.
Implementation
Future<void> drainHistoryScroll() async {
while (_historyScrollInFlight ||
_historyScheduled ||
_pendingHistoryPx != 0 ||
_pendingHistoryLines != 0) {
if (!_historyScrollInFlight &&
!_historyScheduled &&
(_pendingHistoryPx != 0 || _pendingHistoryLines != 0)) {
_scheduleHistoryFlush();
}
final waiter = Completer<void>();
_historyIdleWaiters.add(waiter);
await waiter.future;
}
}