clear method

void clear()

Empties the pane, because someone asked for it to be empty.

The c key, and nothing else. A child writing kClearScreen does not reach here — see kRedrawDivider.

Only what is shown is dropped: the settled lines and each stream's current frame. A stream's unterminated pending is deliberately left alone — it is the line that stream is part way through writing, and dropping half of it would splice the rest onto nothing when the next chunk lands. It is off the screen until then, which is all a clear ever promised.

Implementation

void clear() {
  _settled.clear();
  _stdout.transient = null;
  _stderr.transient = null;

  // A scroll position into a buffer that no longer exists points at nothing,
  // and a pane holding one after a clear draws blank — which reads as the
  // service having died rather than as the screen having been emptied.
  _scrollTop = null;

  notifyListeners();
}