terminal = $terminal; } /** * Update how many terminal rows the input currently occupies. * * Called by FrameRenderer after each render. */ public function setInputRowCount(int $rows): void { $this->inputRowCount = \max(1, $rows); } /** * Get the maximum number of rows available for overlay content. * * Subtracts the input height from the terminal height, reserving * one row for breathing room. In compact mode, also caps at half * the terminal height. * * @param bool $compact If true, use at most half the terminal height */ public function getAvailableRows(bool $compact = false): int { $terminalHeight = $this->terminal->getHeight(); // Reserve 1 row for status line / breathing room $available = $terminalHeight - $this->inputRowCount - 1; if ($compact) { $halfTerminal = (int) \floor($terminalHeight / 2); $available = \min($available, $halfTerminal); } return \max(1, $available); } }