Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Undo is also confused with narrow-to-region
- X-seq: zsh-workers 35698
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: Re: Undo is also confused with narrow-to-region
- Date: Mon, 06 Jul 2015 09:39:57 +0100
- In-reply-to: <CAHYJk3T_a=TAjVr6e79x8bOh6u+vWO9aDXS=fNNHbm7XejLP_A@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- Organization: Samsung Cambridge Solution Centre
- References: <8242.1435937191@thecus.kiddle.eu> <CAHYJk3T_a=TAjVr6e79x8bOh6u+vWO9aDXS=fNNHbm7XejLP_A@mail.gmail.com>
On Fri, 3 Jul 2015 20:12:13 +0200
Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> On Fri, Jul 3, 2015 at 5:26 PM, Oliver Kiddle <okiddle@xxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author