zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh-workers@zsh.org
Subject: Re: Bug in ZSH's vi emulation
Date: Wed, 02 Nov 2016 17:51:23 +0100	[thread overview]
Message-ID: <11719.1478105483@hydra.kiddle.eu> (raw)
In-Reply-To: <20161102045925.GA6763@fujitsu.shahaf.local2>

Daniel Shahaf wrote:
> > On Oct 5, 10:09am, Ghjuvan' Lacambre wrote:
> > } 'd.' isn't a valid action as '.' is not a valid motion, yet 'd.' is
> > } recorded as the last action called. When using '.', 'd.' will
> > } recursively call itself

> Is it simply a matter of setting vichgbufptr to 0 if getvirange()
> returns -1?  I've tried that; it fixes the problem and passes
> tests.

Not really. If we want a quick fix for 5.3 then either that or checking
virangeflag at the top of virepeatchange will do the job.

For a correct vi compatible fix, anything that causes the widget -
vi-delete or whatever to return failure should abort the vi change
and the previous value of vichgbuf should be restored. So most
occurences of vichgflag = 0 could change to call a new endvichange() which
would do the restore. Or that might be factored out into the caller.

I'm also pondering the interaction with user-defined widgets.
Note that from vi, with a key mapping of :nmap \d dwdw
Then, \d followed by dot will remove three words not four.
dot only repeats the final change. In practice this isn't especially
useful so things like the repeat.vim plugin exist. I'm not sure
that we should even strive for vi compatibility here but I think
we're missing some logic in cases where calls to startvichange occur
as part of a user-defined widget.

We've also got a separate issue of only lastchar being stuffed into
vichgbuf so repeating, e.g. gU doesn't work. Why is keybuflen only
1 in startvichange? That, along with what the general point of lastchar
is, has me fairly puzzled.

Oliver


  reply	other threads:[~2016-11-02 16:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-05  8:09 Ghjuvan' Lacambre
2016-10-05 17:19 ` Bart Schaefer
2016-11-02  4:59   ` Daniel Shahaf
2016-11-02 16:51     ` Oliver Kiddle [this message]
2016-11-02 17:34       ` Peter Stephenson
2016-11-02 18:46       ` Bart Schaefer
2016-11-02 23:19       ` Bart Schaefer
2016-11-03  1:54         ` Daniel Shahaf
2016-11-03  4:12       ` Bart Schaefer
2016-11-03  9:36         ` Peter Stephenson
2016-11-03  4:44       ` Bart Schaefer
2016-11-03 12:43         ` Oliver Kiddle
2016-11-03 13:08           ` Bart Schaefer
2016-11-03 14:55           ` Bart Schaefer
2016-11-03 14:57             ` Bart Schaefer
2016-11-03 16:06           ` 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=11719.1478105483@hydra.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).