about summary refs log tree commit diff
path: root/Src/lex.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-03-22 16:22:13 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-03-22 16:22:13 +0000
commit08dec290d4d6558f95df9e22daf3a9940547442a (patch)
tree9eb814910f2b5c396d2cd82928e5e7ce14f1984d /Src/lex.c
parent7dd4c69371b1b8a3bdb7e89a14f1750559b8cc42 (diff)
downloadzsh-08dec290d4d6558f95df9e22daf3a9940547442a.tar.gz
zsh-08dec290d4d6558f95df9e22daf3a9940547442a.tar.xz
zsh-08dec290d4d6558f95df9e22daf3a9940547442a.zip
Fix ZLE access to pushed history line
Diffstat (limited to 'Src/lex.c')
-rw-r--r--Src/lex.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/Src/lex.c b/Src/lex.c
index f25bd3eca..8f432515c 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -249,6 +249,13 @@ lexsave(void)
     ls->histdone = histdone;
     ls->stophist = stophist;
     stophist = 0;
+    if (!lstack) {
+	/* top level, make this version visible to ZLE */
+	zle_chline = chline;
+	/* ensure line stored is NULL-terminated */
+	if (hptr)
+	    *hptr = '\0';
+    }
     ls->hline = chline;
     chline = NULL;
     ls->hptr = hptr;
@@ -355,6 +362,11 @@ lexrestore(void)
     errflag = 0;
 
     ln = lstack->next;
+    if (!ln) {
+	/* Back to top level: don't need special ZLE value */
+	DPUTS(chline != zle_chline, "BUG: Ouch, wrong chline for ZLE");
+	zle_chline = NULL;
+    }
     free(lstack);
     lstack = ln;
 }