Re: [IPython 5] [Docs] Custom Terminal Prompts
Carl Smith <[email protected]> Wed, 13 Jul 2016 21:04:39 +0100
| Newsgroups | gmane.comp.python.ipython.devel |
|---|---|
| Message-ID | <CAP-uhDfBrSB7EZW2GBEjP86=7=gpEEi0K9pBBHuGJrS=wHPoew@mail.gmail.com> |
On 13 July 2016 at 19:45, Fernando Perez <[email protected]> wrote: > > On Wed, Jul 13, 2016 at 3:38 AM, Thomas Kluyver <[email protected]> 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 [email protected] _______________________________________________ IPython-dev mailing list [email protected] https://mail.scipy.org/mailman/listinfo/ipython-dev