Skip to content

Commit 30caa8d

Browse files
committed
Revert "bug #48089 [Console] Fix clear line with question in section (maxbeckers)"
This reverts commit caffee8, reversing changes made to f14901e.
1 parent 5cb3ee5 commit 30caa8d

File tree

3 files changed

+0
-50
lines changed

3 files changed

+0
-50
lines changed

src/Symfony/Component/Console/Output/ConsoleSectionOutput.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,6 @@ public function addContent(string $input)
8787
}
8888
}
8989

90-
/**
91-
* @internal
92-
*/
93-
public function incrementLines()
94-
{
95-
++$this->lines;
96-
}
97-
9890
/**
9991
* {@inheritdoc}
10092
*/

src/Symfony/Component/Console/Style/SymfonyStyle.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
use Symfony\Component\Console\Helper\TableSeparator;
2323
use Symfony\Component\Console\Input\InputInterface;
2424
use Symfony\Component\Console\Output\ConsoleOutputInterface;
25-
use Symfony\Component\Console\Output\ConsoleSectionOutput;
2625
use Symfony\Component\Console\Output\OutputInterface;
2726
use Symfony\Component\Console\Output\TrimmedBufferOutput;
2827
use Symfony\Component\Console\Question\ChoiceQuestion;
@@ -351,11 +350,6 @@ public function askQuestion(Question $question): mixed
351350
if ($this->input->isInteractive()) {
352351
$this->newLine();
353352
$this->bufferedOutput->write("\n");
354-
if ($this->output instanceof ConsoleSectionOutput) {
355-
// add one line more to the ConsoleSectionOutput because of the `return` to submit the input
356-
// this is relevant when a `ConsoleSectionOutput::clear` is called.
357-
$this->output->incrementLines();
358-
}
359353
}
360354

361355
return $answer;

src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@
1616
use Symfony\Component\Console\Exception\RuntimeException;
1717
use Symfony\Component\Console\Formatter\OutputFormatter;
1818
use Symfony\Component\Console\Input\ArrayInput;
19-
use Symfony\Component\Console\Input\Input;
2019
use Symfony\Component\Console\Input\InputInterface;
2120
use Symfony\Component\Console\Output\ConsoleOutputInterface;
2221
use Symfony\Component\Console\Output\ConsoleSectionOutput;
2322
use Symfony\Component\Console\Output\NullOutput;
2423
use Symfony\Component\Console\Output\OutputInterface;
25-
use Symfony\Component\Console\Output\StreamOutput;
2624
use Symfony\Component\Console\Style\SymfonyStyle;
2725
use Symfony\Component\Console\Tester\CommandTester;
2826

@@ -183,38 +181,4 @@ public function testMemoryConsumption()
183181

184182
$this->assertSame(0, memory_get_usage() - $start);
185183
}
186-
187-
public function testAskAndClearExpectFullSectionCleared()
188-
{
189-
$answer = 'Answer';
190-
$inputStream = fopen('php://memory', 'r+');
191-
fwrite($inputStream, $answer.\PHP_EOL);
192-
rewind($inputStream);
193-
$input = $this->createMock(Input::class);
194-
$sections = [];
195-
$output = new ConsoleSectionOutput(fopen('php://memory', 'r+', false), $sections, StreamOutput::VERBOSITY_NORMAL, true, new OutputFormatter());
196-
$input
197-
->method('isInteractive')
198-
->willReturn(true);
199-
$input
200-
->method('getStream')
201-
->willReturn($inputStream);
202-
203-
$style = new SymfonyStyle($input, $output);
204-
205-
$style->write('foo');
206-
$givenAnswer = $style->ask('Dummy question?');
207-
$output->write('bar');
208-
$output->clear();
209-
210-
rewind($output->getStream());
211-
$this->assertEquals($answer, $givenAnswer);
212-
$this->assertEquals(
213-
'foo'.\PHP_EOL. // write foo
214-
\PHP_EOL.\PHP_EOL.\PHP_EOL." \033[32mDummy question?\033[39m:".\PHP_EOL.' > '.\PHP_EOL.\PHP_EOL.\PHP_EOL. // question
215-
'bar'.\PHP_EOL. // write bar
216-
"\033[10A\033[0J", // clear 10 lines (9 output lines and one from the answer input return)
217-
stream_get_contents($output->getStream())
218-
);
219-
}
220184
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy