-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Description
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Symfony version | 3.3.9 |
When ProgressBar has been displayed, cleared, and then displayed again, the second display()
call thinks the progress bar is still visible, and incorrectly rewinds the cursor up to previous lines when the format string has multiple lines.
This test program:
echo "1\n2\n3\n4\n5\n";
sleep(1);
$progressBar = new ProgressBar($output, 100);
$progressBar->setFormat("hello\nworld\n");
$progressBar->display();
sleep(1);
$progressBar->clear();
sleep(1);
$progressBar->display();
sleep(1);
results in output where 4 and 5 have been overwritten:
1
2
3
hello
world
Perhaps clear()
should set $this->firstRun
back to true. (Or to be more flexible in case interpolated values contain newlines, overwrite()
could track how many lines were actually written.)