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

Fernando Perez fperez.net at gmail.com
Thu Apr 5 14:18:04 EDT 2007

On 4/5/07, Thorsten Kampe <thorsten at thorstenkampe.de> wrote:

> I now received an answer from Eric Blake, the Cygwin readline
> maintainer. Basically he says that the Prompt code in IPython (and the
> other applications that have the problem) is buggy. Here's his main
> statement:
> > In other words, the common bug in all three programs you mentioned
> > is that they copied bash's escape sequences, but NOT bash's round of
> > internal expansion, prior to calling readline.
> > [...]
> > Just because most other terminals (rxvt, xterm, ...) are tolerant of
> > unknown control characters, and treat spurious invisible \001 as
> > non-printing characters, doesn't mean that lftp, yafc, or IPython
> > should assume that all terminals behave that way.
> Could you have a look at this and see whether he's right or wrong?

Even without looking, there's a very good chance he's right, for the
simple reason that he probably knows what he's talking about, while I
don't :)

Seriously, I know about the low-level details of readline and ANSI
terminals as little as possible, and what I learned was just the
minimum necessary to hack the code into behaving on all terminals I
had access to.

So from a 'purity' standpoint, it's *very* likely that what I'm doing
is highly dubious.  However, it has the minor merit of actually
working on most terminals (cygwin excepted).

If anyone can send us patches that are more correct from the
readline/ANSI perspective, while simultaneously keeping the current
user-visible correct behavior on all the terminals we work on
(konsole, gnome-terminal, rxvt, xterm, OSX Terminal, OSX X11 xterm,
Win32 cmd terminal, probably more), I'm all for it.  Note that the
behavior with very long lines, wrapping and history needs to be
checked everywhere as well.

If in addition such a patch happens to also fix the Cygwin issue, even better!



More information about the IPython-dev mailing list