Re: Multiline editing in a qtconsole-style app

Thomas Kluyver <[email protected]>
Newsgroups gmane.comp.python.ipython.devel
Message-ID <CAOvn4qjF8LmBjFM+nY9qfJ6HAvEPw-a4oyJy=khnj8Ub1O9fNQ@mail.gmail.com>
Hi Ray,

On 28 November 2015 at 21:08, Osborn, Raymond <[email protected]> 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

_______________________________________________
IPython-dev mailing list
[email protected]
https://mail.scipy.org/mailman/listinfo/ipython-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.