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

"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...)

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to