File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
src/Symfony/Component/Console Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ class ProgressHelper extends Helper
36
36
private $ format = null ;
37
37
private $ redrawFreq = 1 ;
38
38
39
+ private $ lastMessagesLength ;
39
40
private $ barCharOriginal ;
40
41
41
42
/**
@@ -384,8 +385,13 @@ private function humaneTime($secs)
384
385
private function overwrite (OutputInterface $ output , $ messages )
385
386
{
386
387
$ output ->write ("\x0D" ); // carriage return
387
- $ output ->write ("\x1B\x5B\x4B" ); // clear line
388
+ if ($ this ->lastMessagesLength !==null ){
389
+ $ output ->write (str_repeat ("\x20" , $ this ->lastMessagesLength )); //clear the line with the length of the last message
390
+ $ output ->write ("\x0D" ); // carriage return
391
+ }
388
392
$ output ->write ($ messages );
393
+
394
+ $ this ->lastMessagesLength =strlen ($ messages );
389
395
}
390
396
391
397
/**
Original file line number Diff line number Diff line change @@ -80,8 +80,18 @@ protected function getOutputStream()
80
80
return new StreamOutput (fopen ('php://memory ' , 'r+ ' , false ));
81
81
}
82
82
83
+ protected $ lastMessagesLength ;
84
+
83
85
protected function generateOutput ($ expected )
84
86
{
85
- return "\x0D\x1B\x5B\x4B" .$ expected ;
87
+ $ expectedout = $ expected ;
88
+
89
+ if ($ this ->lastMessagesLength !==null ){
90
+ $ expectedout =str_repeat ("\x20" , $ this ->lastMessagesLength )."\x0D" .$ expected ;
91
+ }
92
+
93
+ $ this ->lastMessagesLength =strlen ($ expected );
94
+
95
+ return "\x0D" .$ expectedout ;
86
96
}
87
97
}
You can’t perform that action at this time.
0 commit comments