Re: Getting psql to redisplay command after \e
Fabien COELHO <coelho@cri.ensmp.fr>
From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2019-10-31T09:09:14Z
Lists: pgsql-hackers
Hello Tom, >> psql=> select 1... >> psql-> <prompt> > >> I cannot move back with readline to edit further, I'm stuck there, which >> is strange. > > I don't follow. readline doesn't allow you to edit already-entered lines > today, that is, after typing "select 1<return>" you see > > regression=# select 1 > regression-# > > and there isn't any way to move back and edit the already-entered line > within readline. Yep. My point is to possibly not implicitely <return> at the end of \e, but to behave as if we were moving in history, which allows editing the lines, so that you would get psql=> select 1<cursor> Instead of the above. > I agree it might be nicer if you could do that, but that's *far* beyond > the scope of this patch. It would take entirely fundamental rethinking > of our use of libreadline, if indeed it's possible at all. I also don't > see how we could have syntax-aware per-line prompts if we were allowing > readline to treat the whole query as one line. I was suggesting something much simpler than rethinking readline handling. Does not mean that it is a good idea, but while testing the patch I would have liked the unfinished line to be in the current editing buffer, basically as if I had not typed <nl>. ISTM more natural that \e behaves like history when coming back from editing, i.e. the \e-edited line is set as the current buffer for readline. > In the larger picture, tinkering with how that works would affect > every psql user at the level of "muscle memory" editing habits, > and I suspect that their reactions would not be uniformly positive. > What I propose here doesn't affect anyone who doesn't use \e at all. > Even for \e users it doesn't have any effect on what you need to type. -- Fabien.
Commits
-
Make psql redisplay the query buffer after \e.
- d1c866e57f11 13.0 landed