Zsh Mailing List Archive
Messages sorted by:
Re: Append cancelled commands to history
- X-seq: zsh-users 14973
- From: "Nadav Har'El" <nyh@xxxxxxxxxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Append cancelled commands to history
- Date: Fri, 26 Mar 2010 23:23:49 +0300
- Cc: zsh-users@xxxxxxx
- Hebrew-date: 12 Nisan 5770
- In-reply-to: <100324091951.ZM25340@xxxxxxxxxxxxxxxxxxxxxx>
- List-help: <mailto:firstname.lastname@example.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:email@example.com>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20080919162045.GA22435@xxxxxxxxxxxx> <20090706151644.6BF508027106@xxxxxxxxxxxxxxxxxx> <20090706154309.GA15663@xxxxxxxxxxxxxxxxxxxxxxxxxx> <20090706155337.GB15663@xxxxxxxxxxxxxxxxxxxxxxxxxx> <20100315164237.GA23224@xxxxxxxxxxxxxxxxxxxxxxxxxx> <100320105027.ZM20067@xxxxxxxxxxxxxxxxxxxxxx> <20100322084226.GA26739@xxxxxxxxxxxxxxxxxxxxxxxxxx> <100322080712.ZM21793@xxxxxxxxxxxxxxxxxxxxxx> <20100324102732.GA23038@xxxxxxxxxxxxxxxxxxxxxxxxxx> <100324091951.ZM25340@xxxxxxxxxxxxxxxxxxxxxx>
On Wed, Mar 24, 2010, Bart Schaefer wrote about "Re: Append cancelled commands to history":
> } 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?
> Oh, of course. Zsh *always* makes the immediately preceding accepted
> input available for scrollback in the line editor, even if it was not
> put into the history (because of HIST_IGNORE_ALL_DUPS, HIST_NO_STORE,
> or HIST_IGNORE_SPACE, etc.).
> There is no way to prevent this.
Thanks. I think I understand better now what is happening. What I still find
a bit odd is the fact that this behavior (of saving the partially entered
command in a special place outside the history) is only applied to whole
lines of multiline commands, and not to interrupted single line commands,
or to the last partially-written line of a multiline command. I have two
reservations about this behavior:
1. Why this should apply only to multi-line commands
2. Why is that special (out of history) memory location for one last command
is needed, or even desired. If it was added, I assume people wanted to
scroll back to it. Now, what happens if you accidentally run some other
command and only then wish to scroll back to that interrupted command?
You can't. So what's wrong with just using the normal history to store it?
> You could, however, stop using the interrupt signal and its trap, and
> instead re-bind ctrl-C (or whatever your interrupt key is) to a zle
> function that, whenever $PREBUFER is non-empty, does a no-op equivalent
> of accept-line followed by a send-break.
Thanks! Maybe I'll indeed try that. I'm a bit reluctant, though, to go
through all this complexity just to avoid that extra partial history
(or not really history :-)) entry. Because, like I said, the simple 4-line
zle && [[ $HISTNO -eq $HISTCMD ]] && print -sr -- "$PREBUFFER$BUFFER"
already saves the partial command (single or multi-line) correctly.
Thanks again for your explanations, and I'll try your trick later.
Nadav Har'El | Friday, Mar 26 2010, 12 Nisan 5770
Phone +972-523-790466, ICQ 13349191 |Strike not only while the iron is hot,
http://nadav.harel.org.il |make the iron hot by striking it.
Messages sorted by: