Re: Invisible PROMPT2
David Fetter <david@fetter.org>
From: David Fetter <david@fetter.org>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>, Thomas Munro <thomas.munro@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2019-11-13T18:12:16Z
Lists: pgsql-hackers
On Wed, Nov 13, 2019 at 03:06:08PM -0300, Alvaro Herrera wrote: > 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. So something like %w[...%w] where people could put things like PROMPT1 inside? Best, David. -- David Fetter <david(at)fetter(dot)org> http://fetter.org/ Phone: +1 415 235 3778 Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate
Commits
-
psql: Fix %w length in PROMPT2 when PROMPT1 contains a newline.
- 1713a0013f90 13.0 landed
-
Allow invisible PROMPT2 in psql.
- 7f338369ca62 13.0 landed