Re: Add colors to the prompt for status indicators

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Nov 14, 2010, at 12:50 PM, Andrew Sayers wrote:

> It's possible to work around this for a whole script:
> 
> foo() {
> echo -e "\033[;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0m"
> }
> PS1='\[$(foo)'\]>'

If $(foo) were to emit some actual printable characters, won't this make
bash ignore them when calculating line lengths?

> As a fan of colourful prompts, I'd be very happy if you found a way
> around this for parts of a script.  But as a fan of fast prompts, I'd
> prefer not to call __git_ps1 more than once :)

I don't think there is any way around this, besides patching bash to be
intelligent and determine which PS1 characters are printable itself without
relying on \[ and \].

-Kevin Ballard
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]