ANSI Color Escapes in $PS1.. heh.
Just how stupid an idea did I have when I did this:
$PS1="[\e[31m\h\e[m:\e[34m\u\e[m:\e[31m\w\$\e[m]"
in my /etc/profile?
It looks really nifty until I try to do commands that wrap around, in which
case the first line returns, but keeps going on the current spot.
The real disaster, however, occurs when I get into the command buffer...
each time I hit the left arrow, it smears about half the command up a line.
Does bash figure its wraps like so?:
if ( length($PS1) + length($input) > $screen_width ){ print "\n"; }
Because if so, I understand why it is doing what it's doing.
I'm mainly curious, but it makes the whole command-line experience easier
for my newbie eyes when the prompt is in color.
TIA,
-Ryan King
Reply to: