scheduleWrite method

void scheduleWrite(
  1. Uint8List bytes
)

Coalesce PTY-bound bytes (TUI scroll, batched arrows) to one output event per scheduling tick — same hop model as scroll coalescing.

Implementation

void scheduleWrite(Uint8List bytes) {
  if (_disposed || _outputCtl.isClosed || bytes.isEmpty) return;
  // TUI scroll / batched keys: open interactive drain window for echo.
  _client?.markInteractive();
  _pendingWrite.add(bytes);
  if (_writeFlushScheduled) return;
  _writeFlushScheduled = true;
  _schedule(_flushPendingWrite);
}