zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <Peter.Stephenson@csr.com>
To: "Zsh Hackers' List" <zsh-workers@zsh.org>
Subject: Re: PATCH: $ZLE_LINE_ABORTED
Date: Tue, 7 Sep 2010 13:02:31 +0100	[thread overview]
Message-ID: <20100907130231.49dcf737@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <AANLkTinjkD7F53shp+vWZu01J-a48MxhbvFGpDrZshhC@mail.gmail.com>

On Tue, 7 Sep 2010 13:46:55 +0200
Nikolai Weibull <now@bitwi.se> wrote:
> On Tue, Sep 7, 2010 at 12:44, Peter Stephenson
> <Peter.Stephenson@csr.com> wrote:
> > Here's what I think is a useful one-line change.  If there's an
> > error in the line editor, including ^G, the line being edited gets
> > copied to the variable ZLE_LINE_ABORTED.
> 
> Does this include pressing ^C at the “correct A to B” prompt?

No, that's all done after the line manager has exited.  It's a nuisance the
line doesn't appear in the history (or anywhere else), but it's an entirely
different problem.  Could save the last successfully edited line (whatever
happens to it later) in yet another variable...  Oh, actually, you can do
that yourself...  The following seems to handle both cases.  It would be
more logical to unset ZLE_LINE_ABORTED in zle-line-init.  This works for
the spelling correction part even without the last patch.

zle-line-finish() {
   typeset -g ZLE_LINE_EDITED=$BUFFER
   # This is only called on a successful exit, so we don't need
   # the last aborted line any more...
   unset ZLE_LINE_ABORTED
}
recover-line() {
   if [[ -n $ZLE_LINE_ABORTED ]]; then
     LBUFFER=$ZLE_LINE_ABORTED
     RBUFFER=
   elif [[ -n $ZLE_LINE_EDITED ]]; then
     LBUFFER=$ZLE_LINE_EDITED
     RBUFFER=
   fi
}
zle -N zle-line-finish
zle -N recover-line

-- 
Peter Stephenson <pws@csr.com>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom


  reply	other threads:[~2010-09-07 12:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-07 10:44 Peter Stephenson
2010-09-07 11:46 ` Nikolai Weibull
2010-09-07 12:02   ` Peter Stephenson [this message]
2010-09-07 14:31     ` Greg Klanderman
2010-09-07 14:44       ` Peter Stephenson
2010-09-07 14:51         ` Greg Klanderman
2010-09-12 19:49           ` Mikael Magnusson
2010-09-12 19:51             ` Mikael Magnusson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100907130231.49dcf737@pwslap01u.europe.root.pri \
    --to=peter.stephenson@csr.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).