-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Fix clearing sections containing questions #28638
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
Conversation
@@ -123,6 +124,10 @@ private function doAsk(OutputInterface $output, Question $question) | |||
$ret = trim($this->autocomplete($output, $question, $inputStream, \is_array($autocomplete) ? $autocomplete : iterator_to_array($autocomplete, false))); | |||
} | |||
|
|||
if ($output instanceof ConsoleSectionOutput) { | |||
$output->addContent($ret); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How will this work with hidden input? There might not be any additional lines to clear in that case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Answering questions still implies to hit enter
, empty and hidden inputs result in a blank line on the screen. Just tried it, works as expected with hidden questions
(4.1 or master? see target branch vs description) |
@nicolas-grekas 4.1, fixed thanks |
0e9e6b4
to
81ec57d
Compare
|
||
class ConsoleSectionOutputTest extends TestCase | ||
{ | ||
private $stream; | ||
|
||
protected function setUp() | ||
{ | ||
$this->stream = fopen('php://memory', 'r+', false); | ||
$this->stream = fopen('php://memory', 'r+b', false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be reverted /cc @nicolas-grekas
|
||
public function testClearSectionContainingQuestion() | ||
{ 8000 | ||
$inputStream = fopen('php://memory', 'r+b', false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, no b
needed
Thank you @chalasr. |
…asr) This PR was merged into the 4.1 branch. Discussion ---------- [Console] Fix clearing sections containing questions | Q | A | ------------- | --- | Branch? | 4.1 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #28615 | License | MIT | Doc PR | n/a Given: ```php $section = $output->section(); $question = "What's your name?"; $name = (new QuestionHelper())->ask($input, $section, new Question($question)); $section->clear(); $section->writeln("$question (<info>$name</info>)"); ``` Before:  After:  Commits ------- 81ec57d [Console] Fix clearing sections containing questions
Given:
Before:

After:
