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

Commit c34d5f6

Browse filesBrowse files
Fix Table when running console on Windows
1 parent ed7d7aa commit c34d5f6
Copy full SHA for c34d5f6

File tree

1 file changed

+6
-6
lines changed
Filter options
  • src/Symfony/Component/Console/Helper

1 file changed

+6
-6
lines changed

‎src/Symfony/Component/Console/Helper/Table.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Helper/Table.php
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -618,12 +618,12 @@ private function buildTableRows(array $rows): TableRows
618618
if (isset($this->columnMaxWidths[$column]) && Helper::width(Helper::removeDecoration($formatter, $cell)) > $this->columnMaxWidths[$column]) {
619619
$cell = $formatter->formatAndWrap($cell, $this->columnMaxWidths[$column] * $colspan);
620620
}
621-
if (!strstr($cell ?? '', "\n")) {
621+
if (!strstr($cell ?? '', \PHP_EOL)) {
622622
continue;
623623
}
624-
$escaped = implode("\n", array_map([OutputFormatter::class, 'escapeTrailingBackslash'], explode("\n", $cell)));
624+
$escaped = implode(\PHP_EOL, array_map([OutputFormatter::class, 'escapeTrailingBackslash'], explode(\PHP_EOL, $cell)));
625625
$cell = $cell instanceof TableCell ? new TableCell($escaped, ['colspan' => $cell->getColspan()]) : $escaped;
626-
$lines = explode("\n", str_replace("\n", "<fg=default;bg=default></>\n", $cell));
626+
$lines = explode(\PHP_EOL, str_replace(\PHP_EOL, '<fg=default;bg=default></>'.\PHP_EOL, $cell));
627627
foreach ($lines as $lineKey => $line) {
628628
if ($colspan > 1) {
629629
$line = new TableCell($line, ['colspan' => $colspan]);
@@ -684,9 +684,9 @@ private function fillNextRows(array $rows, int $line): array
684684
if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
685685
$nbLines = $cell->getRowspan() - 1;
686686
$lines = [$cell];
687-
if (strstr($cell, "\n")) {
688-
$lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
689-
$nbLines = \count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines;
687+
if (strstr($cell, \PHP_EOL)) {
688+
$lines = explode(\PHP_EOL, str_replace(\PHP_EOL, '<fg=default;bg=default>'.\PHP_EOL.'</>', $cell));
689+
$nbLines = \count($lines) > $nbLines ? substr_count($cell, \PHP_EOL) : $nbLines;
690690

691691
$rows[$line][$column] = new TableCell($lines[0], ['colspan' => $cell->getColspan(), 'style' => $cell->getStyle()]);
692692
unset($lines[0]);

0 commit comments

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