By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,571 Members | 960 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,571 IT Pros & Developers. It's quick & easy.

Re: sys.ps1 with formatting (linux)

P: n/a
Hi all,

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:

sys.ps2="\001\033[1m\033[32m\002 .\001\033[0m\002"

Solution found in:
^A and ^B delimit invisible caracters for readline to count right
Aug 6 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.