about summary refs log tree commit diff
path: root/Src/Zle
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2004-09-13 13:04:39 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2004-09-13 13:04:39 +0000
commit1268f477b0d88ff10b7de4dea33b53b29cbed287 (patch)
tree06826b9b7a7a59a4e179ae634c949e018ad1bec1 /Src/Zle
parentb12c16850521328a396bb62c3b07558f9308c621 (diff)
downloadzsh-1268f477b0d88ff10b7de4dea33b53b29cbed287.tar.gz
zsh-1268f477b0d88ff10b7de4dea33b53b29cbed287.tar.xz
zsh-1268f477b0d88ff10b7de4dea33b53b29cbed287.zip
20363: Src/init.c, Src/Zle/zle_main.c
Diffstat (limited to 'Src/Zle')
-rw-r--r--Src/Zle/zle_main.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 5299c755b..80c0db6ed 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -688,17 +688,27 @@ zlecore(void)
 	selectlocalmap(NULL);
 	bindk = getkeycmd();
 	if (bindk) {
-	    if (!ll && isfirstln && !(zlereadflags & ZLRF_IGNOREEOF) &&
-		lastchar == eofchar) {
+	    if (!ll && isfirstln && lastchar == eofchar) {
 		/*
 		 * Slight hack: this relies on getkeycmd returning
 		 * a value for the EOF character.  However,
 		 * undefined-key is fine.  That's necessary because
 		 * otherwise we can't distinguish this case from
 		 * a ^C.
+		 *
+		 * The noxitct test is done in the top-level loop
+		 * if zle is not running.  As we trap EOFs at this
+		 * level inside zle we need to mimic it here.
+		 * If we break, the top-level loop will actually increment
+		 * noexitct an extra time; that doesn't cause any
+		 * problems.
 		 */
-		eofsent = 1;
-		break;
+		if (!(zlereadflags & ZLRF_IGNOREEOF) ||
+		    ++noexitct >= 10)
+		{
+		    eofsent = 1;
+		    break;
+		}
 	    }
 	    if (execzlefunc(bindk, zlenoargs))
 		handlefeep(zlenoargs);