8000 [Console] Format unset codes break with scrollbar · Issue #27832 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[Console] Format unset codes break with scrollbar #27832
Closed
@ro0NL

Description

@ro0NL

Symfony version(s) affected: 4.1, probably lower as well

Description

When working on #22225, i noticed something goes wrong with the CLI unset codes as soon a formatted text spans multiple lines, and the output exceeds the window ($LINES), thus when the scrollbar becomes active.

See #22225 (comment)

How to reproduce

My console window ($LINES x $COLUMNS) is set to 12 x 72

I quickly patched the AboutCommand as follow:

diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php
index b6860a2..973c1e1 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php
@@ -56,6 +56,9 @@ EOT
      */
     protected function execute(InputInterface $input, OutputInterface $output)
     {
+        $output->writeln(str_repeat("pre <error>foo bar baz</error> post", 15));
+        return 0;
+
         $io = new SymfonyStyle($input, $output);

Now running it during 1 session (my scrollbar is invisible here btw 😅)

1st 👍

image

2nd 👍

image

3rd 👎

image

Possible Solution
Not sure, I hope someone can explain what's happening technically.

Additional context

return sprintf("\033[%sm%s\033[%sm", implode(';', $setCodes), $text, implode(';', $unsetCodes));

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0