On 11/13/19 12:49 PM, David Fetter wrote: >> Or just define %w as meaning "whitespace of the same width as >> PROMPT1". You couldn't use it *in* PROMPT1, then, but I see >> no use-case for that anyway. > > +1 for doing it this way. Would it make more sense to error out if > somebody tried to set that in PROMPT1, or ignore it, or...?
Define it as "difference between PROMPT1's width and the total width of non-%w elements in this prompt". Then it has a defined meaning in PROMPT1 too (which could be arbitrary if it appears only once, but has to be zero in case it appears more than once). Easter egg: expand it to backspaces if used in PROMPT2 among other stuff that's already wider than PROMPT1. ;) Regards, -Chap