From: Junio C Hamano Date: Mon, 08 Oct 2012 21:17:08 GMT Subject: Re: [PATCH 1/2] Allow __git_ps1 to be used in PROMPT_COMMAND Message-ID: <7v7gr0k6jv.fsf@alter.siamese.dyndns.org> In-Reply-To: <50732EA1.7040608@xs4all.nl> Simon Oosthoek writes: > How about "This has advantages for using color without running > into prompt-wrapping issues. Only by assigning \[ and \] to PS1 > directly can bash know these and the color codes in between don't > count in the length of the prompt."? > > I'll rewrite the patch later on... > > Isn't it confusing that the color codes don't figure in this patch at all? Since the "Subject:" is "allow ... to be used in PROMPT_COMMAND", it very much is relevant to mention that we need to use PROMPT_COMMAND in order to correctly use \[ and \] to generated zero-width escape sequences, which cannot be done by simply setting PS1 to command substitution. "color" is just an example; if it makes you uneasy to say "color", you can say zero-width escape sequences. It could be \007 (BEL) ;-) > I don't think it would be possible to detect any other kind of > customization without including specific code for it. Do you think it's > unnecessary to include a warning? (I think it would take people a long > time to figure out why their prompt goes whoopsy without getting a hint > that PROMPT_COMMAND messes up the PS1) I think you need your warning _only_ because you attempt to auto-detect it, when you do not have to. > (OTOH, if you configure PROMPT_COMMAND, you're bound to know a little > bit about what you're doing...) Yup.