zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@ibmth.df.unipi.it>
To: Vincent Lefevre <Vincent.Lefevre@ens-lyon.fr>,
	zsh-workers@sunsite.auc.dk (Zsh hackers list)
Subject: PATCH: 3.1.5*: Re: [bug] Resizing an xterm while zsh queries the user
Date: Fri, 05 Feb 1999 14:02:18 +0100	[thread overview]
Message-ID: <9902051302.AA36901@ibmth.df.unipi.it> (raw)
In-Reply-To: "Vincent Lefevre"'s message of "Fri, 05 Feb 1999 12:40:04 NFT." <19990205124003.A26678@vin.ens-lyon.fr>

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@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


       reply	other threads:[~1999-02-05 13:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <19990205124003.A26678@vin.ens-lyon.fr>
1999-02-05 13:02 ` Peter Stephenson [this message]
1999-02-13 14:35   ` Vincent Lefevre
1999-02-13 14:29     ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9902051302.AA36901@ibmth.df.unipi.it \
    --to=pws@ibmth.df.unipi.it \
    --cc=Vincent.Lefevre@ens-lyon.fr \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).