Re: Invisible PROMPT2
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>,
Kyotaro Horiguchi <horikyota.ntt@gmail.com>,
David Fetter <david@fetter.org>, ilmari@ilmari.org,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2019-11-18T17:21:53Z
Lists: pgsql-hackers
Thomas Munro <thomas.munro@gmail.com> writes: > On Mon, Nov 18, 2019 at 1:49 PM Alvaro Herrera <alvherre@2ndquadrant.com> wrote: >> On 2019-Nov-18, Thomas Munro wrote: >>> Nice idea. Here's one like that, that just does the counting at the >>> end and looks out for readline control codes. It's pretty naive about >>> what "width" means though: you'll get two spaces for UTF-8 encoded é, >>> and I suppose a complete implementation would know about the half >>> width/full width thing for Chinese and Japanese etc. > Yeah. Maybe pg_wcswidth() would be OK though, and it's available in > psql, though I guess you'd have to make a copy with the escaped bits > stripped out. Right, you should use pg_wcswidth() or the underlying PQdsplen() function to compute display width. The latter might be more convenient since you could apply it character by character rather than making a copy of the string. regards, tom lane
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