Skip to content

Navigation Menu

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

Revert "[Command] fix emojis messing up the line width" #40697

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions 19 src/Symfony/Component/Console/Helper/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Component\Console\Helper;

use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\String\UnicodeString;

/**
* Helper is the base class for all helper classes.
Expand Down Expand Up @@ -46,11 +45,7 @@ public function getHelperSet()
*/
public static function strlen(?string $string)
{
$string ?? $string = '';

if (preg_match('//u', $string)) {
return (new UnicodeString($string))->width(false);
}
$string = (string) $string;

if (false === $encoding = mb_detect_encoding($string, null, true)) {
return \strlen($string);
Expand All @@ -64,9 +59,9 @@ public static function strlen(?string $string)
*
* @return string The string subset
*/
public static function substr(?string $string, int $from, int $length = null)
public static function substr(string $string, int $from, int $length = null)
{
$string ?? $string = '';
$string = (string) $string;

if (false === $encoding = mb_detect_encoding($string, null, true)) {
return substr($string, $from, $length);
Expand Down Expand Up @@ -123,13 +118,7 @@ public static function formatMemory(int $memory)

public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, ?string $string)
{
$string = self::removeDecoration($formatter, $string);

if (preg_match('//u', $string)) {
return (new UnicodeString($string))->width(true);
}

return self::strlen($string);
return self::strlen(self::removeDecoration($formatter, $string));
}

public static function removeDecoration(OutputFormatterInterface $formatter, ?string $string)
Expand Down
2 changes: 1 addition & 1 deletion 2 src/Symfony/Component/Console/Helper/QuestionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu
$remainingCharacters = substr($ret, \strlen(trim($this->mostRecentlyEnteredValue($fullChoice))));
$output->write($remainingCharacters);
$fullChoice .= $remainingCharacters;
$i = (false === $encoding = mb_detect_encoding($fullChoice, null, true)) ? \strlen($fullChoice) : mb_strlen($fullChoice, $encoding);
$i = self::strlen($fullChoice);

$matches = array_filter(
$autocomplete($ret),
Expand Down
2 changes: 2 additions & 0 deletions 2 src/Symfony/Component/Console/Style/SymfonyStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,8 @@ private function createBlock(iterable $messages, string $type = null, string $st
}

$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) {
Expand Down

This file was deleted.

This file was deleted.

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