-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Moved question prompt to readline() function #16458
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
Conversation
@@ -172,7 +173,11 @@ protected function writePrompt(OutputInterface $output, Question $question) | ||
$message = $question->getPrompt(); | ||
} | ||
|
||
$output->write($message); | ||
if ($this->inputStream == STDIN && function_exists('readline')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be strict (===
) comparison and yoda (see 440 line).
could you please add a test for this bugfix? |
@OskarStark I'm not 100% sure how to add a test-case for this. |
i'am not sure, too, but maybe anyone else can help or give you a tipp ping @javiereguiluz |
this is broken in case the message is decorated |
@jaytaph Any news on this one? |
@fabpot @stof is right. It will break decorated messages (as they are not parsed through the decorators). I'm not 100% sure if that is (easily) fixable though, as readline will print the message directly and cannot use the decorators, so either it's using undecorated questions, or have incorrect prompt behaviour. I'm happy to change the PR if somebody find other solutions (for instance, if we could pass the prompt through decorators first, but i'm not 100% sure if that is possible). Still leaves the issue open of testing, which i'm not sure if that is actually feasible. |
Would it be better to revert readline support in the meantime? ping @javiereguiluz |
Sadly, I think so. Right now it doesn't work properly. |
I agree. Let's remove readline support for now until someone comes up with a thorough fix for this issue. |
closing in favour of #17669 |
This PR fixes the issue as described in #15583 by capturing the output of
writePrompt()
and passing this as the actual prompt in thereadline()
method. This way, all readline functionality (cursus movements, screen redraws and screen resizing) will work as expected.