zsh-workers
 help / color / mirror / code / Atom feed
* Undo is confused after push-line-or-edit?
@ 2015-07-03  3:09 Bart Schaefer
  2015-07-03 12:24 ` Oliver Kiddle
  0 siblings, 1 reply; 2+ messages in thread
From: Bart Schaefer @ 2015-07-03  3:09 UTC (permalink / raw)
  To: zsh-workers

If you execute push-line-or-edit, and then any SINGLE editing action in
the multi-line buffer, and then undo, the undo reverts all the way back
to the prompt.  E.g., start with

% { : begin a block  
cursh> some more stuff 
execute: push-line-or-edit_

Which leaves you at

% { : begin a block
cursh>  
% { : begin a block
some more stuff

Now ctl-w to kill "stuff":

% { : begin a block
some more

Now ctl-x ctl-u erases everything, when I would have expected it to put
back the "stuff".  If you do more than one editing action, you can repeat
the undo back as far as the the second one, but the first one is always
skipped and the entire buffer erased instead.

Incorrect initialization of undo_changeno ?  Missing mkundoent()?


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Undo is confused after push-line-or-edit?
  2015-07-03  3:09 Undo is confused after push-line-or-edit? Bart Schaefer
@ 2015-07-03 12:24 ` Oliver Kiddle
  0 siblings, 0 replies; 2+ messages in thread
From: Oliver Kiddle @ 2015-07-03 12:24 UTC (permalink / raw)
  To: zsh-workers

Bart wrote:
> Now ctl-x ctl-u erases everything, when I would have expected it to put
> back the "stuff".  If you do more than one editing action, you can repeat
> the undo back as far as the the second one, but the first one is always
> skipped and the entire buffer erased instead.
> 
> Incorrect initialization of undo_changeno ?  Missing mkundoent()?

After getting a line from the buffer stack, it should create an undo
entry. I can get similar effects with a simple print -z.

This does somewhat complicate the trick of creating undo entries from
zle-line-init if you want them to precede the initial buffer: you need
to start with zle undo and add another split-undo with an empty buffer
before restoring the buffer.

Oliver

diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index fe561fc..c13e3a0 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1206,6 +1206,7 @@ zleread(char **lp, char **rp, int flags, int context, char *init, char *finish)
 	    histline = stackhist;
 	    stackhist = -1;
 	}
+	handleundo();
     }
     /*
      * If main is linked to the viins keymap, we need to register


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-03 12:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-03  3:09 Undo is confused after push-line-or-edit? Bart Schaefer
2015-07-03 12:24 ` Oliver Kiddle

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).