summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--Src/Zle/zle_utils.c17
2 files changed, 23 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index e26e62e5f..b2291f5b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-10-26  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* users/20825: Src/Zle/zle_utils.c: get_undo_current_change()
+	needs same protection as mkundoent() for execution within
+	completion.
+
 2015-10-25  Daniel Shahaf  <d.s@daniel.shahaf.name>
 
 	* 36962: Completion/Unix/Command/_git: _git: Fix completion of
diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
index 714d911a6..ffff8fd1c 100644
--- a/Src/Zle/zle_utils.c
+++ b/Src/Zle/zle_utils.c
@@ -1739,9 +1739,26 @@ zlecallhook(char *name, char *arg)
 zlong
 get_undo_current_change(UNUSED(Param pm))
 {
+    int remetafy;
+
+    /*
+     * Yuk: we call this from within the completion system,
+     * so we need to convert back to the form which can be
+     * copied into undo entries.
+     */
+    if (zlemetaline != NULL) {
+	unmetafy_line();
+	remetafy = 1;
+    } else
+	remetafy = 0;
+
     /* add entry for any pending changes */
     mkundoent();
     setlastline();
+
+    if (remetafy)
+	metafy_line();
+
     return undo_changeno;
 }