Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Append cancelled commands to history



On Mon, Mar 22, 2010, Bart Schaefer wrote about "Re: Append cancelled commands to history":
> On Mar 22, 10:42am, Nadav Har'El wrote:
> Something like this may work:
>...

Thanks! I wasn't aware of the zshaddhistory hook. Zsh has improved since
I last read its manual from cover to cover (circa 1995) :-)

Anyway, I tried what you wrote, and it didn't work because it appears the
zshaddhistory hook does not get called when I interrupt the ZLE.

But, further experimentation yielded that my problem is caused by something
either stranger:

Without any special hooks or trapint, if you try entering a multiline command
like

	for i in 1 2 3
	do

and then interrupt it, if you now go up in history you'll see this interrupted
command (but not the last line you interrupted on).
BUT, if you now run "history", you don't see this line! Even stranger, after
you run that "history" command and you try to go up, you no longer find this
history line.

So apparently, that interrupted multiline editing is *not* in the history,
and never was. So where is it? Why do I see it when I go "up" for the first
time? How do I prevent this? Again, I didn't find the relevant places in
the code :(

Thanks,
Nadav.


-- 
Nadav Har'El                        |     Wednesday, Mar 24 2010, 9 Nisan 5770
nyh@xxxxxxxxxxxxxxxxxxx             |-----------------------------------------
Phone +972-523-790466, ICQ 13349191 |I want to be a human being, not a human
http://nadav.harel.org.il           |doing -- Scatman John



Messages sorted by: Reverse Date, Date, Thread, Author