Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: 3.1.5*: Re: [bug] Resizing an xterm while zsh queries the user



Vincent Lefevre wrote:
> For instance, if I type "rm blah/*", zsh asks:
> 
> zsh: sure you want to delete all the files in /home/vlefevre/blah [yn]?
> 
> But if I resize the xterm, zsh considers that I've typed [return],
> though I haven't typed anything. Could this be fixed?

Here's a simple patch for that.  I'm not in one of my moods for
oversophistication.

--- Src/utils.c.qint	Fri Feb  5 10:08:47 1999
+++ Src/utils.c	Fri Feb  5 13:59:27 1999
@@ -1155,9 +1155,22 @@
 
 /**/
 int
+read1char(void)
+{
+    char c;
+
+    while (read(SHTTY, &c, 1) != 1) {
+	if (errno != EINTR)
+	    return -1;
+    }
+    return STOUC(c);
+}
+
+/**/
+int
 getquery(char *valid_chars, int purge)
 {
-    char c, d;
+    int c, d;
     int isem = !strcmp(term, "emacs");
 
 #ifdef FIONREAD
@@ -1180,7 +1193,7 @@
 	return 'n';
     }
 #endif
-    while (read(SHTTY, &c, 1) == 1) {
+    while ((c = read1char()) >= 0) {
 	if (c == 'Y' || c == '\t')
 	    c = 'y';
 	else if (c == 'N')
@@ -1202,13 +1215,13 @@
     }
     if (isem) {
 	if (c != '\n')
-	    while (read(SHTTY, &d, 1) == 1 && d != '\n');
+	    while ((d = read1char()) >= 0 && d != '\n');
     } else {
 	settyinfo(&shttyinfo);
 	if (c != '\n' && !valid_chars)
 	    write(SHTTY, "\n", 1);
     }
-    return (int)c;
+    return c;
 }
 
 static int d;

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



Messages sorted by: Reverse Date, Date, Thread, Author