pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Make psql redisplay the query buffer after \e.
Date: Fri, 22 Nov 2019 22:08:01 +0000
Message-ID: <E1iYH5t-0004Rs-TH@gemulon.postgresql.org> (raw)

Make psql redisplay the query buffer after \e.

Up to now, whatever you'd edited was put back into the query buffer
but not redisplayed, which is less than user-friendly.  But we can
improve that just by printing the text along with a prompt, if we
enforce that the editing result ends with a newline (which it
typically would anyway).  You then continue typing more lines if
you want, or you can type ";" or do \g or \r or another \e.

This is intentionally divorced from readline's processing,
for simplicity and so that it works the same with or without
readline enabled.  We discussed possibly integrating things
more closely with readline; but that seems difficult, uncertainly
portable across different readline and libedit versions, and
of limited real benefit anyway.  Let's try the simple way and
see if it's good enough.

Patch by me, thanks to Fabien Coelho and Laurenz Albe for review

Discussion: https://postgr.es/m/13192.1572318028@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d1c866e57f1156000a51ff7e26590984d32bab53

Modified Files
--------------
doc/src/sgml/ref/psql-ref.sgml | 16 +++++++++++-----
src/bin/psql/command.c         |  3 ++-
src/bin/psql/mainloop.c        | 20 ++++++++++++++++++++
3 files changed, 33 insertions(+), 6 deletions(-)



Message-ID: <E1iYH5t-0004Rs-TH@gemulon.postgresql.org>
Permalink:  ../E1iYH5t-0004Rs-TH@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1iYH5t-0004Rs-TH@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Make psql redisplay the query buffer after \e.
  In-Reply-To: <E1iYH5t-0004Rs-TH@gemulon.postgresql.org>
  References: <E1iYH5t-0004Rs-TH@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox