Skip to content

Commit f917a03

Browse files
authored
Fix output with newlines
When adding newlines using Frame->newline(), it only adds "\n" to the next row of the frame. If the new output was smaller than the previous one (by removing items for example), simply writing"\n" over the line doesn't clear it, so I'm using \033[2K to clear the line beforehand.
1 parent b175ebb commit f917a03

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/CliMenu.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,9 @@ protected function draw() : void
272272

273273
$this->terminal->moveCursorToTop();
274274
foreach ($frame->getRows() as $row) {
275+
if ($row == "\n") {
276+
$this->terminal->write("\033[2K");
277+
}
275278
$this->terminal->write($row);
276279
}
277280
$this->terminal->write("\033[J");

0 commit comments

Comments
 (0)