Qt Console output spacing #2082

Closed
bfroehle opened this Issue Jul 2, 2012 · 7 comments

Projects

None yet

3 participants

@bfroehle

In IPython (=0.13) Qt Console, there seems to be a missing newline before the Out parameter in the first plot command after running pylab. See, for example In [2] and Out[2]:

Python 2.7.3 (default, Apr 20 2012, 22:39:59) 
Type "copyright", "credits" or "license" for more information.

IPython 0.13 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.
%guiref   -> A brief reference about the graphical user interface.

In [1]: pylab

Welcome to pylab, a matplotlib-based Python environment [backend: TkAgg].
For more information, type 'help(pylab)'.

In [2]: plot([1,2,3])Out[2]: [<matplotlib.lines.Line2D at 0x3e40210>]

In [3]: plot([1,2,3])
Out[3]: [<matplotlib.lines.Line2D at 0x3e34d10>]

In [4]: 
@bfroehle

git bisect points the origin of the issue to 1422d27, but I haven't investigated further.

1422d277055ed26b7a367e6ce2c1649d32548ee9 is the first bad commit
commit 1422d277055ed26b7a367e6ce2c1649d32548ee9
Author: Matthias BUSSONNIER <bussonniermatthias@gmail.com>
Date:   Fri May 25 17:15:55 2012 +0200

    new completer for qtconsole.

    add a completer to the qtconsole that is navigable by arraow keys and
    tab. One need to call it twice to get it on focus and be able to select
    completion with Return. looks like zsh completer, not the gui drop down
    list of --gui-completer.

    This also try to split the completion logic from console_widget, and try
    to keep the old completer qui around. The plain completer that never
    takes focus back, and the QlistWidget completer.

    to switch between the 3, the --gui-completion flag as been changed to
    take an argument (plain, droplist, ncurses).

@Carreau Carreau was assigned Jul 2, 2012
@fperez
IPython member

Confirming, though I see slightly different behavior: I simply don't see the first Out after plotting for the first time. This is what it looks like to me:

In [1]: pylab

Welcome to pylab, a matplotlib-based Python environment [backend: Qt4Agg].
For more information, type 'help(pylab)'.

In [2]: plot([1,2,3,4])

In [3]: plot([1,2,3,4])
Out[3]: [<matplotlib.lines.Line2D at 0x30a6490>]

In any case, bug indeed. Bummer.

@Carreau
IPython member

hum.. I know a commit of mine introduced the bug, but i'll have difficulty tracking it down as I can't reproduce it...
Does invoking the completer once (plo<tab>..) change the behavior ?

@fperez
IPython member

No @Carreau, I get the same thing even if I invoke the completer. Do you not see any problem at all?

@Carreau
IPython member

No, I don't get it at all. On neither of my 2 computers.
I don't see any reason why it should do that, except a race condition in PyQt/PySide event handeling that erase the temporary buffer after a newline is printed, but even thought, the buffer is zero len, so it should not do this, and the clearing of the buffer is not made by bindings event...

I'm thinking on what can be done.
I would try do make _clear_temporary_buffer no-op in IPython/frontend/qt/console/console_widget.py, (be carefull not to use the completer) and try again. Also look at wether or not the old completer (--gui-completion=plain) does the same.

i'll see if I can get this behavior on a VM...

@Carreau
IPython member

Did reproduce it on a linux VM, @fperez, @bfroehle could you try #2101 to see if it works on both your cases ?

@bfroehle

Yes, works for me.

@Carreau Carreau added a commit that closed this issue Jul 5, 2012
@Carreau Carreau fix completer deletting newline
fixes #2082
dd5f651
@Carreau Carreau closed this in dd5f651 Jul 5, 2012
@Carreau Carreau added a commit to Carreau/ipython that referenced this issue Jul 13, 2012
@Carreau Carreau fix completer deletting newline
fixes #2082

backported to 0.13.1 from PR #2101
d3bda82
@minrk minrk added a commit that referenced this issue Jul 21, 2012
@minrk minrk Backport PR #2101: fix completer deletting newline
should fixes #2082

do not forget to backport to 0.13.1
a784e32
@mattvonrocketstein mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
@Carreau Carreau fix completer deletting newline
fixes #2082
4a1e04b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment