history = $history; } /** * {@inheritdoc} */ public function execute(Buffer $buffer, Terminal $terminal, Readline $readline): bool { if ($buffer->moveToNextVisualRow( $terminal->getWidth(), $readline->getPromptWidthForCurrentLine($buffer) )) { return true; } if ($readline->isMultilineMode() && !$buffer->isOnLastLine()) { $buffer->moveToNextLine(); return true; } if (!$this->history->isInHistory()) { $terminal->bell(); return true; } $entry = $this->history->getNext(); if ($entry !== null) { $buffer->setText($entry); } else { $terminal->bell(); } return true; } /** * {@inheritdoc} */ public function getName(): string { return 'next-history'; } }