Zsh Mailing List Archive
Messages sorted by:
Re: zle: vi mode: wrong undo handling on fresh lines
- X-seq: zsh-workers 32304
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: zle: vi mode: wrong undo handling on fresh lines
- Date: Sat, 25 Jan 2014 00:19:07 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1390605549; bh=V9BUdTS49wEMcvCrtyFBe2fWNHrPu46TQY+yG8yCnw0=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Received:In-reply-to:From:References:To:Subject:MIME-Version:Content-Type:Content-ID:Content-Transfer-Encoding:Date:Message-ID; b=WCP6m5VYenrHIZxH8Zt6NBFF1oT87B9AUCMwpQ320up5vPDozCnaNdRXfYKqx23G2cc/IqUdJEfWxgxPUGz69/dgI6h2+CZ7zuX3jFglBvKCucNn+6j22Krw4pI1yyqsl6XHH6i4KnataU5A9q4ZuVLGacpN8jFow6g91SzC1Pk=
- In-reply-to: <firstname.lastname@example.org>
- List-help: <mailto:email@example.com>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:firstname.lastname@example.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CANWLQWsV5i+=3NptAxir6UYCoipFa2Pk+g6D1DDnMnJMVCbDgA@mail.gmail.com> <email@example.com>
On 23 Sep, Peter Stephenson wrote:
> Hauke Petersen <hkptrsn@xxxxxxxxx> wrote:
> > Insert operations should count as a single step in the undo history,
> > i.e. from command mode
> > ifoo<ESC>u
> > should effectively be a no-op.
> > AFAICT, zsh handles this fine with the exception of fresh lines.
> Is it something like this, perhaps?
I find the effect of this change to undo to be very annoying. Typically
undo now wipes the whole buffer which isn't much use. In particular, the
old behaviour of undo after a completion is important to me. I
understand that it rightly should be marking the start of an insertion
at this point. However, even aside from that, the change doesn't seem to
be quite right: e.g. vi-repeat (dot) can't repeat the initial insertion.
My setup is something of a hybrid: vi-mode but with many emacs-mode
widgets bound in insert mode. In most cases where there are identically
named vi- widgets, the only difference is that the vi- ones honour the
viinsbegin position (so I use the emacs ones). Note that vim has relaxed
some of these so you can do things like backspace past the start of a
change. Rather usefully, a vim Ctrl-W (backward-kill-word), will stop at
the start position but go on if invoked a second time. I can't find a
way to implement that in a zsh user-defined widget mainly because the
return status of vi-backward-kill-word doesn't seem to be helping me.
It is no bad thing to group successive inserts into a single undo event
(most editors, emacs included do this). The question is how to provide
some control so something like a backward-delete-word or completion can
be treated as a separate undo event. vim solves this by letting you
break a change into two undo blocks with Ctrl-G u. This doesn't alter
the vi change start position, only the undo stack. Is a widget to do
that possible? Another possibility which comes to mind would be to add a
flag like ZLE_KEEPSUFFIX† to mark widgets that start a new undo block,
though I realise those flags aren't currently configurable.
†Incidentally, I bind escape to first do zle auto-suffix-retain so
vi-cmd-mode should perhaps have ZLE_KEEPSUFFIX set.
Messages sorted by: