-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
[Console] Correct max width for ChoiceQuestion #15368
Comments
Indeed, I also interested what is the policy in symfony On Sat, Jul 25, 2015 at 06:12:52PM -0700, Mikhail Osher wrote:
Mr Alexander Pletnev |
solution is not that straightforward, as |
This PR was submitted for the 2.8 branch but it was merged into the 2.7 branch instead (closes #17314). Discussion ---------- Fix max width for multibyte keys in choice question Fixes wrong key max width for ChoiceQuestion in multibyte strings Before: ![before](https://cloud.githubusercontent.com/assets/2435655/12203385/977e88c0-b626-11e5-9425-d497f84a9ab3.png) After: ![after](https://cloud.githubusercontent.com/assets/2435655/12203390/9d9a0b4e-b626-11e5-8d4e-ba9290820778.png) To replicate you can use this code as an example: ``` namespace AppBundle\Command; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ChoiceQuestion; class QuesionCommand extends Command { protected function configure() { $this->setName('app:question'); $this->setDescription('Command for testing PR'); } protected function execute(InputInterface $input, OutputInterface $output) { $helper = $this->getHelper('question'); $question = new ChoiceQuestion('Choose something:', [ 'foo' => 'foo', 'żółw' => 'bar', 'łabądź' => 'baz', 'известно' => 'lorem', 'газета' => 'ipsum', ], 0); $colour = $helper->ask($input, $output, $question); $output->writeln('you have chosen: ' . $colour); } } ``` | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #15368 | License | MIT | Doc PR | - Commits ------- 5d2463b Fix max width for multibyte keys in choice question
https://github.com/symfony/Console/blob/2.7/Helper/QuestionHelper.php#L160
Here is a wrong calculation for cyrillic values.
The text was updated successfully, but these errors were encountered: