Thread: pgsql: Make psql redisplay the query buffer after \e.

pgsql: Make psql redisplay the query buffer after \e.

From
Tom Lane
Date:
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(-)