Zsh Mailing List Archive
Messages sorted by:
Re: Append cancelled commands to history
- X-seq: zsh-users 14967
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Append cancelled commands to history
- Date: Wed, 24 Mar 2010 09:19:49 -0700
- In-reply-to: <20100324102732.GA23038@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- 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: <c16a574a0809181450t61a5b5ddq2e80797fde37636e@xxxxxxxxxxxxxx> <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>
On Mar 24, 12:27pm, Nadav Har'El wrote:
} 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.
Ah. That makes sense. I was assuming it didn't work for me because
of the $PREBUFFER-is-empty problem (for which a patch has since been
posted on zsh-workers).
} 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.
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.
typeset -gi INTR_PRESSED=0
if (( INTR_PRESSED ))
add-zsh-hook preexec finish_simulated_interrupt
if [[ -n $PREBUFFER ]]
zle -U $'\a' # Replace with your send-break keystroke
zle -N simulate-interrupt
Rebinding keys to call simulate-interrupt instead of sending a real
terminal driver interrupt, is left as an exercise.
Messages sorted by: