<div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444">No problem, Yuri - mostly just followed Thomas' pointers.</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444"><br></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444">Thanks again, Thomas. Yep - printing the first line of the prompt from a callback should work fine. I didn't think about the event API.</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444"><br></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444">The current API for defining custom prompts is powerful, but pretty low level, and it becomes more complicated if you need custom token classes to use different colours. It'd be nice if there was also a wrapper API that would take strings, like bash prompts, and parse them into prompt_toolkit token arrays and plumb them in automatically.</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444"><br></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444">The actual format used in bash prompts makes it awkward to define styles, so I was thinking about reusing Python's string formatting mini-language, and just defining a standard signature that will pass a bunch of helpful stuff to `format` when the prompt is compiled.</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444"><br></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444">No promises, but I'm going to play around with the new prompt API a bit more and see if there's a light way to wrap the current API.</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444"><br></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444">Cheers,</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444"><br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><span style="color:rgb(115,115,115);font-style:italic;line-height:18px"><font size="1" face="monospace, monospace">-- Carl Smith</font></span><br></div></div><div><span style="color:rgb(115,115,115);font-style:italic;line-height:18px"><font size="1" face="monospace, monospace"><a href="mailto:carl.input@gmail.com" target="_blank">carl.input@gmail.com</a></font></span></div></div></div></div></div></div>
<br><div class="gmail_quote">On 13 July 2016 at 11:38, Thomas Kluyver <span dir="ltr"><<a href="mailto:takowl@gmail.com" target="_blank">takowl@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">Thanks Carl!<br></div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On 13 July 2016 at 01:34, Carl Smith <span dir="ltr"><<a href="mailto:carl.input@gmail.com" target="_blank">carl.input@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail_default"><font color="#444444" face="monospace, monospace">The commit that adds the examples:</font></div><div class="gmail_default"><font color="#444444" face="monospace, monospace"><a href="https://github.com/ipython/ipython/commit/95ed0855ae23e55c10b46903db911265aa1cdd58#diff-c5d5abe11d1c298906cb121c45eb12e2" target="_blank">https://github.com/ipython/ipython/commit/95ed0855ae23e55c10b46903db911265aa1cdd58#diff-c5d5abe11d1c298906cb121c45eb12e2</a></font></div></blockquote><div><br></div></span><div>Sigh, of course we have docs on customising prompts in two places. I'll try to unify them...<br></div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail_default"><font face="monospace, monospace"><span><div style="color:rgb(68,68,68)"></div></span><div style="color:rgb(68,68,68)">One thing I found buggy was the rewrite prompt. If you inherit from `Prompt` and redefine some of the prompt methods in the derived class, as you're meant to do, any prompts that you inherit from `Prompt` will pad themselves out to keep everything aligned. This works well except when you have a multiline prompt.</div></font></div></blockquote></span></div><br></div><div class="gmail_extra">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 (<a href="http://ipython.readthedocs.io/en/stable/config/callbacks.html" target="_blank">http://ipython.readthedocs.io/en/stable/config/callbacks.html</a>).<span class="HOEnZb"><font color="#888888"><br><br></font></span></div><span class="HOEnZb"><font color="#888888"><div class="gmail_extra">Thomas<br></div><div class="gmail_extra"><br></div></font></span></div>
<br>_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
<a href="https://mail.scipy.org/mailman/listinfo/ipython-dev" rel="noreferrer" target="_blank">https://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
<br></blockquote></div><br></div>