Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug in undo/redo handling in conjunction with history-beginning-search-backward
- X-seq: zsh-workers 38540
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: Re: Bug in undo/redo handling in conjunction with history-beginning-search-backward
- Date: Wed, 25 May 2016 03:02:56 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1464138178; bh=RKyhZzEctEsw0yRCcbLZKG5x76GzNM18b6zq+3uwmm4=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=Db+eygDNzWVlpKnFs2v+l+xdKJpLawkdj1VXIpsEGUkHi/BDsHBPCmGMAs25fQK20SD+VtJBTV1PT80d+DdEJYk3oMbmAGE/Ljn8j00ri1s+h60a/AjA8GZaMVyADrDXY1rkZ+OJBMf2dD3nYf/CLVY4b/ejPHAoBwcU5X1VMtHMn1N1caWhJd6smvN3XChRdlOd0zbiOIDXdAiB1OGCxE4WUMhdLd7Z4GeZVdrF8Bhx0quJ1LzEkMjKsiUHq5hQoGPLSNisSAxqtmpRgwPHr0lswWx9nSV7xmtVTkw+r0ZWTVsHRA6ue/sYXLgfR2C+1NT/kkOXNf8nBEC6998Drg==
- In-reply-to: <CAHYJk3TPHXFx96mm-40hvEqnd__8v8mnebiZ1r+thxGorZz=qg@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
- References: <CAHYJk3TPHXFx96mm-40hvEqnd__8v8mnebiZ1r+thxGorZz=qg@mail.gmail.com>
On 20 May, Mikael Magnusson wrote:
> % bindkey -e
> % bindkey '^U' undo
> % bindkey '^Y' redo
> % bindkey '^[C' history-beginning-search-backward
> at this point, type in "bin" and invoke the
> history-beginning-search-backward widget, type a space, then undo and
> redo fully a few times, you'll notice the point where the extra "n"
> starts popping into the command line.
On first attempt, I couldn't reproduce this. I do get the effect with
repeated undos and no redos, however.
The way history line changes are stored in the undo code differs
markedly from other changes. So the code has ended up with special logic
to handle the history changes.
36131 was when I last touched this and I wasn't really happy with the
state of things then but that was just before a two week holiday. At the
time, I said:
It might be better to create full undo entries for history changes
though that would need hacks to ensure that multiple history changes
are undone in a single step.
If this patch doesn't do the job then that might be a better approach
than playing whack-a-mole with further issues.
Oliver
diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
index 68794c6..80219a4 100644
--- a/Src/Zle/zle_utils.c
+++ b/Src/Zle/zle_utils.c
@@ -1589,9 +1589,14 @@ undo(char **args)
break;
if (prev->changeno <= undo_limitno && !*args)
return 1;
- if (!unapplychange(prev) && last_change >= 0)
- unapplychange(prev);
- curchange = prev;
+ if (!unapplychange(prev)) {
+ if (last_change >= 0) {
+ unapplychange(prev);
+ curchange = prev;
+ }
+ } else {
+ curchange = prev;
+ }
} while (last_change >= (zlong)0 || (curchange->flags & CH_PREV));
setlastline();
return 0;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author