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

Re: PROMPT escape sequences



On Sun, 7 Oct 2007, Bart Schaefer wrote:

So the answer to this question is:

} is there a way to set a color at the prompt that doesn't reset to default
} when i tab-complete?

No, there isn't, because you're relying on the entire prompt being re- painted every time zsh needs to redraw the line that begins with the prompt, but ZLE is optimized to use cursor motions and only redraw the bits of the line that actually need changing. It has no idea what the color settings are at any given position on the terminal, so it can't restore color; it only knows what the non-zero-width characters are.
===================

this gets me very close:


expand-or-complete () {
    PREDISPLAY=${fg[cyan]}
    zle .expand-or-complete
}
zle -N expand-or-complete


but it doesn't output any escape characters... just the text string "^[[36m" as if there's an implied ${(V)fg[cyan]}. what do i need to do to make that output a literal escape sequence? why doesn't it work that way by default?

i also tried including "reset-prompt" within the redefined "expand-or-complete", but didn't have any luck with that. i thought that in re-displaying the prompt, it would also re-colorize the text typed at the prompt, but apparently it doesn't.


--
        ...atom

 ________________________
 http://atom.smasher.org/
 762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808
 -------------------------------------------------

	"I never did give them hell. I just told the truth,
	 and they thought it was hell."
		-- Harry S Truman, 3 Apr 1956




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