-
Notifications
You must be signed in to change notification settings - Fork 725
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
Add a "plain" output mode that does not use any ANSI codes #509
Comments
As a hack, I tried adding
Note the repetition of the input prompt (including what the user typed as input) after I hit "enter". |
Hi @infinity0, I understand the problem, but as far as I know, this is something that won't/can't be fixed. prompt_toolkit provides a human interface, not a machine interface. It assumes that stdin and stdout are attached to a TTY for human interaction. If you want to do inter process communication, then you have to use a different library. Applications that want to support piping input to stdin should detect whether the input is a pipe, and if so, they should not use prompt_toolkit, but instead simply read stdin. |
OK, thanks for the explanation. I was a bit confused at first, I thought prompt-toolkit was a bit more invasive than simply doing terminal-based I/O because it has an Application class and an event loop, but I think I might have fixed this directly in IPython with ipython/ipython#10606. |
Applications using prompt-toolkit find it harder to interface with other applications because of the presence of ANSI codes. For example, Cantor wants to use Sage as a backend, and recently this has been broken because Sage uses IPython which uses prompt-toolkit, and Cantor cannot deal with the presence of extra ANSI codes.
IPython, as a hack, has added a
--simple-prompt
option that avoids prompt-toolkit and usesraw_input
instead, but this does not support multiline input. Besides, this is a dirty work-around for prompt-toolkit's lack of support for a "plain" IO mode. It would be cleaner if prompt-toolkit supplied such a functionality itself.The text was updated successfully, but these errors were encountered: