Sergey E. Koposov schrob:
> I submit the new version of my patch (against the CVS tip), correcting the
> problem with \edit (pointed by Andreas). So now everything works fine.
I think there's a pgflush_history() call missing somewhere, since the
buffer isn't flushed on a control-c. The fresh query is appended to
the aborted one in the history:
--8<---------------cut here---------------start------------->8---
nnpg=# select
nnpg-# something_i_would_rather_not_submit_yet
nnpg-# -- <control-c>
nnpg=# select 1;
?column?
----------
1
(1 row)
nnpg=# -- <control-p> will now yield the following history entry
nnpg=# select
something_i_would_rather_not_submit_yet
select 1;
--8<---------------cut here---------------end--------------->8---
Some more comments:
Wouldn't it be more elegant to use the facilities in libpq's
pqexpbuffer.h for the history buffer instead of passing the
buffer-length around as a separate function argument and doing custom
string operations?
The multi-line history entries are not preserved between psql
invocations. Bash does solve this by folding multi-line commands into
a single line where possible. But I have to admit, this could be sold
as another TODO item :-)
regards,
Andreas