Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

command substitution with control chars?

i'm trying to have part of a dynamic prompt that displays in different colors depending on system parameters.

the output of the script starts with some control characters to set the text colors, then outputs some colored text from a script, then outputs ^[[0m to return to normal colors.

if i run the script in precmd() it ~almost~ works 100%... except that the end of the prompt may be hosed by tab-expansion or command line editing (since the control characters aren't properly counted in the width of the prompt). also, this is limited to only having the output of the script at the beginning of the line, although for now that is where i want it.

i suspect the better way to do this would be command substitution in the prompt, but the control chars seem to really be making a mess out of that. any suggestions?



 762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808

	"You don't get everything you want. A dictatorship would
	 be a lot easier."
		-- George "dubya" Bush, describing what it's like
		to be governor of Texas. (Governing Magazine 7/98)

	"If this were a dictatorship, it would be a heck of a lot
	 easier, just so long as I'm the dictator."
		-- George "dubya" Bush
		18 Dec 2000 CNN.com

	"A dictatorship would be a heck of a lot easier, there's
	 no question about it."
		George "dubya" Bush, 27 Jul 2001 Associated Press

Messages sorted by: Reverse Date, Date, Thread, Author