about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-11-11 18:25:44 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-11-11 18:25:44 +0000
commita1958f3c41d4c135173f282a99b9fbe1d0150fad (patch)
treef417f52e7c5bd9158dae4bfaf8fb45e11748e269
parent0e8d56723a6d695104c62793e11a15fdb59949b6 (diff)
downloadzsh-a1958f3c41d4c135173f282a99b9fbe1d0150fad.tar.gz
zsh-a1958f3c41d4c135173f282a99b9fbe1d0150fad.tar.xz
zsh-a1958f3c41d4c135173f282a99b9fbe1d0150fad.zip
26025: prefer handling user input to zle -F file descriptor
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/zle_main.c23
2 files changed, 20 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 4b5ac3b5b..d592ef5cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-11-11  Peter Stephenson  <pws@csr.com>
+
+	* 26025: Src/Zle/zle_main.c: prefer handling user input to
+	file installed with zle -F.
+
 2008-11-11  Clint Adams  <clint@zsh.org>
 
 	* 26023: Completion/Unix/Command/_topgit: skeletal completion for
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 093160808..76bf44cbd 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -585,7 +585,7 @@ raw_getbyte(long do_keytmout, char *cptr)
 	    fds[i+1].events = POLLIN;
 	}
 # endif
-	do {
+	for (;;) {
 # ifdef HAVE_POLL
 	    int poll_timeout;
 
@@ -694,6 +694,19 @@ raw_getbyte(long do_keytmout, char *cptr)
 	    /* If error or unhandled timeout, give up. */
 	    if (selret < 0)
 		break;
+	    /*
+	     * If there's user input handle it straight away.
+	     * This improves the user's ability to handle exceptional
+	     * conditions like runaway output.
+	     */
+	    if (
+# ifdef HAVE_POLL
+		 (fds[0].revents & POLLIN)
+# else
+		 FD_ISSET(SHTTY, &foofd)
+# endif
+		 )
+		break;
 	    if (nwatch && !errtry) {
 		/*
 		 * Copy the details of the watch fds in case the
@@ -755,13 +768,7 @@ raw_getbyte(long do_keytmout, char *cptr)
 		zfree(lwatch_fds, lnwatch*sizeof(int));
 		freearray(lwatch_funcs);
 	    }
-	} while (!
-# ifdef HAVE_POLL
-		 (fds[0].revents & POLLIN)
-# else
-		 FD_ISSET(SHTTY, &foofd)
-# endif
-		 );
+	}
 # ifdef HAVE_POLL
 	zfree(fds, sizeof(struct pollfd) * nfds);
 # endif