Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Undo is confused after push-line-or-edit?



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



Messages sorted by: Reverse Date, Date, Thread, Author