Make psql redisplay the query buffer after \e.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 22 Nov 2019 22:07:54 +0000 (17:07 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 22 Nov 2019 22:07:54 +0000 (17:07 -0500)
commitd1c866e57f1156000a51ff7e26590984d32bab53
tree44391a289b8e061f3a83ee4e9b81b574e770fe50
parent73b06cf893c9d3bb38c11878a12cc29407e78b6c
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
doc/src/sgml/ref/psql-ref.sgml
src/bin/psql/command.c
src/bin/psql/mainloop.c