[IPython-dev] [IPython-user] bug in coloured prompt

Fernando Perez fperez.net at gmail.com
Wed Apr 4 00:14:22 EDT 2007

On 4/3/07, Thorsten Kampe <thorsten at thorstenkampe.de> wrote:
> * Fernando Perez (Tue, 3 Apr 2007 11:03:12 -0600)
> > On 4/3/07, Thorsten Kampe <thorsten at thorstenkampe.de> wrote:
> > > Where would I have to make the change? In class TermColors?
> >
> > Yes, try to make it similar to InputTermColors and see what happens.
> Oooooops, it's actually the other way round: if I remove the \001/\002
> from "class InputTermColors" then the outprompt (and the inprompts
> still, too) looks fine.

Ah, OK.

> My conclusion: readline may use those \001 \002 to "properly know the
> length of each line and can wrap lines accordingly" but some Windows
> terminals can't interpret them (or they don't ignore them like they
> should or readline doesn't "eat" them like it should).
> Now the question is: why do Windows cmd and Console together with
> Cygwin Python and readline have a problem with those "\001 \002" pairs
> and why do Windows cmd and Console together with Windows Python and
> pyreadline not?!

I don't know.

If I was in a snotty mood, I'd say that the bug is not /in/ Windows,
but that Windows /IS/ the bug.  But that would be mean :)

We do have enough Win32 users that if you can find a patch that makes
all combinations of terminals and environments under win32 work
correctly, I'm sure it will be very welcome.

Note that if you remove those escapes, then very long lines (that
reach the end of the terminal) start wrapping incorrectly and badly
misbehaving.  So if you change anything there, make sure you do lots
of interactive tests with very long lines, recalling them in history,
trying to re-edit them, etc.

And also, any patch for this should be *strictly* confined to win32,
since all terminals work fine under *nix in all its flavors (as far as
I know).



More information about the IPython-dev mailing list