zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh-workers@zsh.org
Subject: Re: zle: vi mode: wrong undo handling on fresh lines
Date: Sat, 25 Jan 2014 00:19:07 +0100	[thread overview]
Message-ID: <3511.1390605547@thecus.kiddle.eu> (raw)
In-Reply-To: <20130923213014.15f97f9e@pws-pc.ntlworld.com>

On 23 Sep, Peter Stephenson wrote:
> Hauke Petersen <hkptrsn@gmail.com> 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.

Oliver


  reply	other threads:[~2014-01-24 23:25 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-22 12:37 Hauke Petersen
2013-09-22 18:24 ` Bart Schaefer
2013-09-22 20:27   ` Hauke Petersen
2013-09-23  4:57     ` Bart Schaefer
2013-09-23 20:30 ` Peter Stephenson
2014-01-24 23:19   ` Oliver Kiddle [this message]
2014-01-25 19:15     ` Bart Schaefer
2014-01-27 12:43       ` Peter Stephenson
2014-01-27 16:11         ` Peter Stephenson
2014-01-28 14:58           ` Peter Stephenson
2014-01-28 16:28             ` Bart Schaefer
2014-01-28 16:47               ` Peter Stephenson
2014-01-28 17:41                 ` Bart Schaefer
2014-01-28 23:00           ` Oliver Kiddle
2014-01-29  2:59             ` Bart Schaefer
2014-01-29 10:50               ` Oliver Kiddle
2014-01-29 14:48                 ` Bart Schaefer
2014-01-30 14:51             ` Jun T.
2014-01-30 15:38               ` Peter Stephenson
2014-01-30 16:03                 ` Bart Schaefer
2014-01-31 12:00               ` Jun T.
2014-01-31 15:19                 ` Bart Schaefer
2014-01-31 15:33                   ` Peter Stephenson
     [not found]               ` <16181.1391175951@thecus.kiddle.eu>
2014-01-31 16:43                 ` Jun T.
2014-01-31 21:37               ` Oliver Kiddle
2014-01-31 22:32                 ` Oliver Kiddle
2014-02-01 19:27                   ` Bart Schaefer
2014-02-03 16:20                   ` Jun T.
2014-02-03 21:29                     ` Oliver Kiddle
2014-02-03 22:20                       ` Bart Schaefer
2014-02-03 23:26                         ` Oliver Kiddle
2014-02-04 17:11                           ` Jun T.
2014-02-05 22:00                             ` Oliver Kiddle
2014-02-02 22:10             ` Oliver Kiddle
2014-02-07 14:43             ` Oliver Kiddle
2014-02-07 16:22               ` Bart Schaefer
2014-01-27 16:29         ` Bart Schaefer

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=3511.1390605547@thecus.kiddle.eu \
    --to=okiddle@yahoo.co.uk \
    --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).