Re: Invisible PROMPT2

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Maxence Ahlouche <maxence.ahlouche@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>, Thomas Munro <thomas.munro@gmail.com>
Date: 2019-11-27T16:09:44Z
Lists: pgsql-hackers
Maxence Ahlouche <maxence.ahlouche@gmail.com> writes:
> The length of %w should probably be computed starting from the last newline
> in PROMPT1.

Good idea, but I think you need to account for "visible" (ie, if the
newline is inside RL_PROMPT_START_IGNORE, it shouldn't change the width).
It might be best to add logic inside the existing "if (visible)" instead
of making a new top-level case.

Another special case that somebody's likely to whine about is \t, though
to handle that we'd have to make assumptions about the tab stop distance.
Maybe assuming that it's 8 is good enough.

			regards, tom lane



Commits

  1. psql: Fix %w length in PROMPT2 when PROMPT1 contains a newline.

  2. Allow invisible PROMPT2 in psql.