setPassthrough method

void setPassthrough(
  1. bool on
)

Enables or disables raw passthrough. While on, bytes from the input are forwarded verbatim to onRaw (bypassing line editing); the local edit buffer and any partial escape/UTF-8 state are reset on each transition.

Implementation

void setPassthrough(bool on) {
  if (_passthrough == on) return;
  _passthrough = on;
  _state = _ParseState.normal;
  _csiParams = '';
  _utf8.clear();
  _utf8Need = 0;
  _buffer.clear();
  _cursor = 0;
  // Entering passthrough: erase whatever is on the current line — e.g. a
  // prompt a `printAbove` repaint left behind (the AI agent prints a `$ cmd`
  // header before its command runs) — so the program/command's output starts
  // on a clean line instead of after a dangling prompt. A committed command
  // always emits `\r\n` first, so in the normal flow this clears an empty line.
  if (on && interactive) _clearInputLine();
}