Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Console] Question helper is behaving differently when inside a Section #47411

Copy link
Copy link
Closed
@bigfoot90

Description

@bigfoot90
Issue body actions

Symfony version(s) affected

6.1.4

Description

The question helper is going onto a new line when used inside a Section, therefore section cannot rewrite correctly

How to reproduce

Question helper only

Code
      $io = new SymfonyStyle($input, $output);

      $countdown = 3;
      while ($countdown > 0) {
          $io->write('Lorem ipsum ' . $countdown);
          $random = $io->ask('Press random key');
          $countdown--;
      }

Section helper only

Code
      $section = $output->section();

      $countdown = 3;
      while ($countdown > 0) {
          $section->clear();
          $section->write('Lorem ipsum ' . $countdown);
          $countdown--;
          sleep(1);
      }

Both combined

Code
      $section = $output->section();
      $io = new SymfonyStyle($input, $section);

      $countdown = 3;
      while ($countdown > 0) {
          $section->clear();
          $section->write('Lorem ipsum ' . $countdown);

          $random = $io->ask('Press random key');
          $countdown--;
      }

Expected

Final output should be

Lorem ipsum 1

 Press random key:
 > something

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.