zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: Zsh workers <zsh-workers@zsh.org>
Subject: Re: Undo is also confused with narrow-to-region
Date: Mon, 06 Jul 2015 09:39:57 +0100	[thread overview]
Message-ID: <20150706093957.33d9cb25@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <CAHYJk3T_a=TAjVr6e79x8bOh6u+vWO9aDXS=fNNHbm7XejLP_A@mail.gmail.com>

On Fri, 3 Jul 2015 20:12:13 +0200
Mikael Magnusson <mikachu@gmail.com> wrote:
> On Fri, Jul 3, 2015 at 5:26 PM, Oliver Kiddle <okiddle@yahoo.co.uk> wrote:
> > Within narrow-to-region, undo will put back the full BUFFER that is then
> > duplicated from PREDISPLAY/POSTDISPLAY. After narrow-to-region, the
> > opposite problem occurs with the part that was not part of the BUFFER
> > being lost.
> >
> > This isn't that easy to solve. recursive-edit could save and restore the
> > undo structures but for some uses of recursive-edit, such as that shown
> > for it in the manual, that might not be the right thing anyway.
> 
> Would it be possible to implement some kind of 'zle push-undo-stack'
> and 'zle pop-undo-stack'? If you push it you would get a whole new
> instance of undo, and popping it then throws all those entries away
> again. I can't really think of an instance outside recursive-edit
> where it would be useful, though.

You can already basically do this: see read-from-minibuffer.

integer changeno=$UNDO_CHANGE_NO

remembers the current undo (the undo numbers are unique up to integer
wrap, which isn't supposed to happen unless you're editing infinite
numbers of editions of Shakespeare using monkeys).

zle undo $changeno

then winds the undos back to that point.

pws


  reply	other threads:[~2015-07-06  8:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-03 15:26 Oliver Kiddle
2015-07-03 18:12 ` Mikael Magnusson
2015-07-06  8:39   ` Peter Stephenson [this message]
2015-07-06 11:46     ` Oliver Kiddle
2015-07-06 19:25       ` Peter Stephenson
2015-07-08 14:57         ` Oliver Kiddle
2015-07-09 18:32           ` Peter Stephenson
2015-07-10  9:34           ` Peter Stephenson

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=20150706093957.33d9cb25@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.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).