sys.ps1 with formatting (linux)
python at hugo.doemaarwat.nl
Wed Aug 6 13:42:07 CEST 2008
My apologies for resurrecting an old thread, but I couldn't find the
answer on the list and others might still have the same problem.
On Mon Jul 23 22:33:22 CEST 2007, Jon Dobson wrote (reformatted):
> I'm trying to set sys.ps1 and sys.ps2 with some formatting using:
> sys.ps2="\033[1m\033[32m .\033[0m"
> I get the colored prompt(s) as you might expect, but I'm getting some
> strange behavior with wrapping. Once the interactive command gets long
> enough to wrap, it wraps back to the same line (overwriting the
> beginning). It doesn't break anything - the command gets interpreted
> correctly, it's just an ugly way to work.
After a couple of hours of having the same problem, I found out that you
should surround the unprintable characters with \001 and \002:
Solution found in: http://hg.secdev.org/scapy/raw-file/tip/scapy.py:
> ^A and ^B delimit invisible caracters for readline to count right
More information about the Python-list