Skip to content

Commit

Permalink
Footer render fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
brendt committed May 29, 2024
1 parent cf507d3 commit 3db371a
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/Terminal/Terminal.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ public function switchToNormalMode(): self

public function render(
InteractiveComponent $component,
array $footerLines = [],
bool $renderFooter = true,
array $footerLines = []
): Generator {
$rendered = $component->render();

Expand All @@ -74,14 +73,12 @@ public function render(
}

foreach ($rendered as $content) {
if ($renderFooter || $footerLines !== []) {
if ($footer = $component->renderFooter()) {
$footerLines = [...$footerLines, $footer];
}

if ($footerLines !== []) {
$content .= PHP_EOL . PHP_EOL . implode(PHP_EOL, $footerLines);
}
if ($footer = $component->renderFooter()) {
$footerLines[] = $footer;
}

if ($footerLines !== []) {
$content .= PHP_EOL . PHP_EOL . implode(PHP_EOL, $footerLines);
}

$this
Expand Down

0 comments on commit 3db371a

Please sign in to comment.