restore method

void restore()

Restores the terminal's echo and line mode flags to their original values.

Safe to call multiple times; best-effort guards prevent throwing if the terminal becomes unavailable between enter/restore calls.

Implementation

void restore() {
  try {
    if (!TerminalContext.input.hasTerminal) return;
  } catch (_) {
    return;
  }
  try {
    TerminalContext.input.echoMode = origEcho;
  } catch (_) {}
  try {
    TerminalContext.input.lineMode = origLineMode;
  } catch (_) {}
}