From 11ca38c6d99192856d33254c504114d4ba8cd258 Mon Sep 17 00:00:00 2001
From: Peter Stephenson
Date: Mon, 26 Oct 2015 10:00:54 +0000
Subject: users/20825: fix crash when complex completion hooks.
get_undo_current_change() needs protecting against execution in
completion environment.
---
Src/Zle/zle_utils.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
(limited to 'Src/Zle/zle_utils.c')
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;
}
--
cgit 1.4.1