8000 [Console] Do no preprend empty line if the buffer is empty by lyrixx · Pull Request #48487 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Console] Do no preprend empty line if the buffer is empty #48487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Symfony/Component/Console/Style/SymfonyStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ private function autoPrependText(): void
{
$fetched = $this->bufferedOutput->fetch();
// Prepend new line if last char isn't EOL:
if (!str_ends_with($fetched, "\n")) {
if ($fetched && !str_ends_with($fetched, "\n")) {
$this->newLine();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;

// ensure that nested tags have no effect on the color of the '//' prefix
return function (InputInterface $input, OutputInterface $output) {
$output = new SymfonyStyle($input, $output);
$output->text('Hello');
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

* Lorem ipsum dolor sit amet
* consectetur adipiscing elit

Expand Down
0