On 2019-Nov-13, David Fetter wrote:
> On Wed, Nov 13, 2019 at 09:47:01AM -0500, Tom Lane wrote:
> > > How about a circumfix directive (like the existing %[ ... %])
> > > that replaces everything inside with whitespace, but keeps the width?
> >
> > 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...?
This seems way too specific to me. I like the "circumfix" directive
better, because it allows one to do more things. I don't have any
immediate use for it, but it doesn't seem completely far-fetched that
there are some.
BTW the psql manual says that %[ and %] were plagiarized from tcsh, but
that's a lie: tcsh does not contain such a feature. Bash does, however.
(I guess not many people read the tcsh manual.)
Neither bash nor tcsh have a feature to return whitespace of anything;
we're in a green field here ISTM.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services