enterFullScreen static method

void enterFullScreen()

Switches the terminal into the "alternate" fullscreen buffer.

Throws UnsupportedError if a terminal is not detected. Uses the ANSI escape sequence \x1B[?1049h.

Implementation

static void enterFullScreen() {
  if (!stdout.hasTerminal) {
    throw UnsupportedError("Terminal is not available");
  }

  stdout.write('\x1B[?1049h'); // Enable alternate screen buffer
  stdout.write('\x1B[H'); // Move cursor to home position
}