[IPython-dev] [IPython 5] [Docs] Custom Terminal Prompts

Carl Smith carl.input at gmail.com
Wed Jul 13 16:04:39 EDT 2016

On 13 July 2016 at 19:45, Fernando Perez <fperez.net at gmail.com> wrote:

> On Wed, Jul 13, 2016 at 3:38 AM, Thomas Kluyver <takowl at gmail.com> wrote:
>> Yes, I think the prompt is conceptually a single line. Does the
>> information in the lines above where you type need to change while you're
>> typing? If not, I'd recommend printing it before the prompt is displayed
>> with the post_run_cell event (
>> http://ipython.readthedocs.io/en/stable/config/callbacks.html).
> Mmh, should we update the rewrite logic to basically work only on the last
> line of the prompt? It could compute the length to write on prompt_string.
> split('\n')[-1] rather than the full prompt_string. It seems to me that
> would give us the correct logic in all cases (including single line
> prompts), no?

​+1 Yep. Basically, it's always going to be last line you want to align to,
whether there's one or more.

Obviously, users should be able to just define their prompt using the API,
instead of defining half the prompt as a print call that happens once per
input on a callback, and the other half as an arrays of tokens that are
generated by a method every time you edit the input.

Not many people will need this functionality, but it should work correctly
if they ever do.

-- Carl Smith
carl.input at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20160713/9189f11e/attachment.html>

More information about the IPython-dev mailing list