[IPython-dev] Multiline editing in a qtconsole-style app

Thomas Kluyver takowl at gmail.com
Sun Nov 29 07:22:35 EST 2015


Hi Ray,

On 28 November 2015 at 21:08, Osborn, Raymond <rosborn at anl.gov> wrote:

> However, I only just noticed that we seem to have lost the ability to do
> multiline editing, without using the Ctrl key modifier. Even with the
> modifier, the indent is not correctly set, so the behavior has diverged
> from the ipython qtconsole, where multiline editing is automatic if the
> code is not complete and a proper indent is set.


I think I know what you're running into. In previous versions of the Qt
console, the frontend decided whether to prompt for another line and how
much to indent it by processing the Python code that was typed in. As we've
moved towards supporting multiple languages, it's not appropriate for the
frontend to make that decision, so it has to ask the kernel about it. It
does that by making is_complete_request to the kernel:
http://jupyter-client.readthedocs.org/en/latest/messaging.html#code-completeness

Assuming you're using the Qt console with an IPython kernel, it should
still be straightforward to use that, but I guess it needs some changes in
your integration code to make sure the message gets through. The widget
object now has an is_complete method, which you can see here:
https://github.com/jupyter/qtconsole/blob/f2c8a31c387ce1e020ccdbb020091de2ee98dbf9/qtconsole/frontend_widget.py#L260

Best wishes,
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20151129/fa4a506c/attachment.html>


More information about the IPython-dev mailing list