resize method

  1. @override
void resize({
  1. required int cols,
  2. required int rows,
})
override

Resizes the terminal, where the backend supports it (no-op otherwise).

Implementation

@override
void resize({required int cols, required int rows}) {
  final path = _ttyPath();
  if (path == null) return; // tty path not recorded yet / resize disabled.
  // `-F` (GNU/util-linux) vs `-f` (BSD/macOS) selects the device to operate on.
  // Setting the size triggers TIOCSWINSZ → SIGWINCH to the foreground program.
  final flag = Platform.isLinux ? '-F' : '-f';
  try {
    Process.runSync('stty', [flag, path, 'rows', '$rows', 'cols', '$cols']);
  } on Object {
    // Best-effort: a transient stty failure must never break the session.
  }
}