On Wed, 7 Dec 2005, Andreas Seltenreich wrote:
> 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:
> 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?
Thank you, Andreas. I corrected the bug and also switched to pqexpbuffer
instead of my own work with the strings.
The new patch is attached.
>
> 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 :-)
>
I also wanted this feature for a long time.
And I agree that it is rather simple to just remove the \n when writing to the
readline history file, but I don't think that's what everybody wants. I
think that people want to preserve the original formatting...
So in that case the solution can be just putting some symbol instead of \n
in the history file, and during the loading of that file replace it back
(that symbol can be zero byte for example). But I'm not sure that people
will like that solution too.
Regards,
Sergey
*****************************************************
Sergey E. Koposov
Max-Planck Institut for Astronomy
Web: http://lnfm1.sai.msu.ru/~math
E-mail: math@sai.msu.ru