From 7eb4db6d9dc3a12ed2176d417bcb5fdbf4f610c7 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 23 Mar 2021 13:24:21 +0100 Subject: [PATCH] [Console] minor fix --- src/Symfony/Component/Console/Helper/QuestionHelper.php | 2 +- src/Symfony/Component/Console/Style/SymfonyStyle.php | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Symfony/Component/Console/Helper/QuestionHelper.php b/src/Symfony/Component/Console/Helper/QuestionHelper.php index d211fcfd1e..6dde580cf6 100644 --- a/src/Symfony/Component/Console/Helper/QuestionHelper.php +++ b/src/Symfony/Component/Console/Helper/QuestionHelper.php @@ -309,7 +309,7 @@ class QuestionHelper extends Helper $remainingCharacters = substr($ret, \strlen(trim($this->mostRecentlyEnteredValue($fullChoice)))); $output->write($remainingCharacters); $fullChoice .= $remainingCharacters; - $i = self::strlen($fullChoice); + $i = (false === $encoding = mb_detect_encoding($fullChoice, null, true)) ? \strlen($fullChoice) : mb_strlen($fullChoice, $encoding); $matches = array_filter( $autocomplete($ret), diff --git a/src/Symfony/Component/Console/Style/SymfonyStyle.php b/src/Symfony/Component/Console/Style/SymfonyStyle.php index ba89fb4220..ecdf9b1a3b 100644 --- a/src/Symfony/Component/Console/Style/SymfonyStyle.php +++ b/src/Symfony/Component/Console/Style/SymfonyStyle.php @@ -496,8 +496,6 @@ class SymfonyStyle extends OutputStyle } $line = $prefix.$line; - $decorationLength = Helper::strlen($line) - Helper::strlenWithoutDecoration($this->getFormatter(), $line); - $messageLineLength = min($this->lineLength - $prefixLength - $indentLength + $decorationLength, $this->lineLength); $line .= str_repeat(' ', max($this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line), 0)); if ($style) {