Skip to content

[Console] ProgressBar & Input #48903

Closed
Closed
@feamsr00

Description

@feamsr00

Symfony version(s) affected

6.2.2 and 6.3.x-dev dc9d4fa

Description

If I start a section with a progress bar and then ask a Question in a new section the progress bar inserts its self between the prompt and the cursor.
(I considered starting a progress bar then asking for input, without sections, but I can't "pin" it, and it rolls away as I ask more questions.)

Curiously, using the progressbar in this way causes it to overwrite the text of the previous input.

 First Name?
 0/3 [>---------------------------]   0%
 Last Name?
 1/3 [=========>------------------]  33%
 Email?
 2/3 [==================>---------]  66%
email@domain<CURSOR>

Press enter and...

 First Name?
 0/3 [>---------------------------]   0%
 Last Name?
 1/3 [=========>------------------]  33%
 Email?
 2/3 [==================>---------]  66%
 3/3 [============================] 100%

To be fair, I am unsure if this is a bug or should be a feature.

How to reproduce

		/** @var SfConsole\Helper\QuestionHelper */
		$oQuestionHelper = $this->getHelperSet()->get('question');
		/** @var SfConsole\Question\Question[] */
		$aQSet = $this->getModelQuestions($oModel);
		// @todo use sections to add a progressbar?
		if ($bUseProgressBar)
		{
			// @todo figure out formatting
			$oQSect=$output->section();
			$oPbSect=$output->section();
			$oPBar=new ProgressBar($oPbSect);
			$oQSet=$oPBar->iterate($aQSet);
		}
		foreach ($oQSet as $sPropName => $oQuestion)
		{
			$ans=$oQuestionHelper->ask($input, $oQSect, $oQuestion);
			//set model with answer
			$oModel->{'set'.$sPropName}($ans);
		}

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions