21
21
use Symfony \Component \Console \Helper \TableCell ;
22
22
use Symfony \Component \Console \Helper \TableSeparator ;
23
23
use Symfony \Component \Console \Input \InputInterface ;
24
- use Symfony \Component \Console \Output \BufferedOutput ;
25
24
use Symfony \Component \Console \Output \OutputInterface ;
25
+ use Symfony \Component \Console \Output \TrimmedBufferOutput ;
26
26
use Symfony \Component \Console \Question \ChoiceQuestion ;
27
27
use Symfony \Component \Console \Question \ConfirmationQuestion ;
28
28
use Symfony \Component \Console \Question \Question ;
@@ -46,7 +46,7 @@ class SymfonyStyle extends OutputStyle
46
46
public function __construct (InputInterface $ input , OutputInterface $ output )
47
47
{
48
48
$ this ->input = $ input ;
49
- $ this ->bufferedOutput = new BufferedOutput ($ output ->getVerbosity (), false , clone $ output ->getFormatter ());
49
+ $ this ->bufferedOutput = new TrimmedBufferOutput ($ output ->getVerbosity (), false , clone $ output ->getFormatter (), \ DIRECTORY_SEPARATOR === '\\' ? 4 : 2 );
50
50
// Windows cmd wraps lines as soon as the terminal width is reached, whether there are following chars or not.
51
51
$ width = (new Terminal ())->getWidth () ?: self ::MAX_LINE_LENGTH ;
52
52
$ this ->lineLength = min ($ width - (int ) (\DIRECTORY_SEPARATOR === '\\' ), self ::MAX_LINE_LENGTH );
@@ -449,9 +449,8 @@ private function autoPrependText(): void
449
449
450
450
private function writeBuffer (string $ message , bool $ newLine , int $ type ): void
451
451
{
452
- // We need to know if the two last chars are PHP_EOL
453
- // Preserve the last 4 chars inserted (PHP_EOL on windows is two chars) in the history buffer
454
- $ this ->bufferedOutput ->write (substr ($ message , -4 ), $ newLine , $ type );
452
+ // We need to know if the last chars are PHP_EOL
453
+ $ this ->bufferedOutput ->write ($ message , $ newLine , $ type );
455
454
}
456
455
457
456
private function createBlock (iterable $ messages , string $ type = null , string $ style = null , string $ prefix = ' ' , bool $ padding = false , bool $ escape = false ): array
0 commit comments