From mboxrd@z Thu Jan 1 00:00:00 1970 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes Message-Id: <9902051302.AA36901@ibmth.df.unipi.it> To: Vincent Lefevre , zsh-workers@sunsite.auc.dk (Zsh hackers list) Subject: PATCH: 3.1.5*: Re: [bug] Resizing an xterm while zsh queries the user In-Reply-To: "Vincent Lefevre"'s message of "Fri, 05 Feb 1999 12:40:04 NFT." <19990205124003.A26678@vin.ens-lyon.fr> Date: Fri, 05 Feb 1999 14:02:18 +0100 From: Peter Stephenson X-Mailing-List: 5281 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 Tel: +39 050 844536 WWW: http://www.ifh.de/~pws/ Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy