[IPython-dev] Using Prompt Toolkit to edit terminal inputs in a screen editor.

Carl Smith carl.input at gmail.com
Tue Jul 19 12:58:54 EDT 2016


​Sorry for sending a blank reply to the list earlier. GMail needs to move
[Send] to the right-hand side.

On 19 July 2016 at 12:10, Thomas Kluyver <takowl at gmail.com> wrote:

> Ooh, nice find. If we can agree on a keyboard shortcut that people like
>> for this, I'd like to enable it by default in IPython.
>>
>
​Sweet. That would cool. Cheers Thomas. I found it a couple of days ago,
and use it all the time. Prompt Toolkit is awesome.

Once you get a reference to their PT cli instance (as `ip.pt_cli`, or the
first arg to any prompt token method, or the `cli` attribute of any event)
you can access the input buffer, set up keybindings and any stuff like that
- basically, anywhere you're just playing with state and event handlers,
you're generally ok. But. There are still a lot of cool options that are in
the PT docs, that we can't access yet from IPython (as far as I tell).

​
The documented APIs for the inaccessible PT features involve passing stuff
to their `parse` method, using named args, but there's no obvious way to
attach the same stuff to a running instance. Any ideas would be
appreciated. As a concrete example, how would an IPython user add a bottom
toolbar:

http://python-prompt-toolkit.readthedocs.io/en/stable/pages/building_prompts.html#adding-a-bottom-toolbar

Thanks,
-- Carl Smith
carl.input at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20160719/23f047e5/attachment.html>


More information about the IPython-dev mailing list