Re: Invisible PROMPT2
Chapman Flack <chap@anastigmatix.net>
From: Chapman Flack <chap@anastigmatix.net>
To: David Fetter <david@fetter.org>, Tom Lane <tgl@sss.pgh.pa.us>
Cc: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>, Thomas Munro <thomas.munro@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2019-11-13T18:03:08Z
Lists: pgsql-hackers
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
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