From 6b5e97ba9da94a42d0b57b22708b4e70b8ca34cb Mon Sep 17 00:00:00 2001 From: Brent Roose Date: Thu, 30 May 2024 13:08:00 +0200 Subject: [PATCH] Fix progress bar --- src/Components/Interactive/ProgressBarComponent.php | 2 +- src/Terminal/Terminal.php | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Components/Interactive/ProgressBarComponent.php b/src/Components/Interactive/ProgressBarComponent.php index d2365f4..29414cb 100644 --- a/src/Components/Interactive/ProgressBarComponent.php +++ b/src/Components/Interactive/ProgressBarComponent.php @@ -51,7 +51,7 @@ public function render(): Generator $bar, $step, $count, - ) . PHP_EOL; + ); }; foreach ($this->data as $item) { diff --git a/src/Terminal/Terminal.php b/src/Terminal/Terminal.php index f5236c5..096703f 100644 --- a/src/Terminal/Terminal.php +++ b/src/Terminal/Terminal.php @@ -73,12 +73,14 @@ public function render( } foreach ($rendered as $content) { + $footerLinesForContent = $footerLines; + if ($footer = $component->renderFooter()) { - $footerLines[] = $footer; + $footerLinesForContent[] = $footer; } - if ($footerLines !== []) { - $content .= PHP_EOL . PHP_EOL . implode(PHP_EOL, $footerLines); + if ($footerLinesForContent !== []) { + $content .= PHP_EOL . PHP_EOL . implode(PHP_EOL, $footerLinesForContent); } $this