about summary refs log tree commit diff
path: root/Src/Zle/zle_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Zle/zle_main.c')
-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);