function ConsoleSectionOutput::setMaxHeight
Defines a maximum number of lines for this section.
When more lines are added, the section will automatically scroll to the end (i.e. remove the first lines to comply with the max height).
File
-
vendor/
symfony/ console/ Output/ ConsoleSectionOutput.php, line 48
Class
- ConsoleSectionOutput
- @author Pierre du Plessis <pdples@gmail.com> @author Gabriel Ostrolucký <gabriel.ostrolucky@gmail.com>
Namespace
Symfony\Component\Console\OutputCode
public function setMaxHeight(int $maxHeight) : void {
// when changing max height, clear output of current section and redraw again with the new height
$previousMaxHeight = $this->maxHeight;
$this->maxHeight = $maxHeight;
$existingContent = $this->popStreamContentUntilCurrentSection($previousMaxHeight ? min($previousMaxHeight, $this->lines) : $this->lines);
parent::doWrite($this->getVisibleContent(), false);
parent::doWrite($existingContent, false);
}