Skip to content

Commit 6faa1c2

Browse files
Fix Table when running console on Windows
1 parent ed7d7aa commit 6faa1c2

File tree

1 file changed

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

1 file changed

+6
-6
lines changed

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

Lines 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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy