zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: 3.1.5*: Re: [bug] Resizing an xterm while zsh queries the user
       [not found] <19990205124003.A26678@vin.ens-lyon.fr>
@ 1999-02-05 13:02 ` Peter Stephenson
  1999-02-13 14:35   ` Vincent Lefevre
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 1999-02-05 13:02 UTC (permalink / raw)
  To: Vincent Lefevre, Zsh hackers list

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: 3.1.5*: Re: [bug] Resizing an xterm while zsh queries the user
  1999-02-13 14:35   ` Vincent Lefevre
@ 1999-02-13 14:29     ` Peter Stephenson
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 1999-02-13 14:29 UTC (permalink / raw)
  To: Vincent Lefevre, Zsh hackers list

Vincent Lefevre wrote:
> It doesn't work very well. For instance:
> 
> $ echo blaj
> zsh: correct 'blaj' to 'blah' [nyae]?
> 
> If I type Ctrl-C, it displays:
> 
> zsh: correct 'blaj' to 'blah' [nyae]? ^C
> 
> but still waits for a character. Then, if I type "y", it displays nothing
> and "echo " goes to the history.

Sorry, I missed that.

--- Src/utils.c.err	Fri Feb  5 13:59:27 1999
+++ Src/utils.c	Sat Feb 13 15:26:32 1999
@@ -1160,7 +1160,7 @@
     char c;
 
     while (read(SHTTY, &c, 1) != 1) {
-	if (errno != EINTR)
+	if (errno != EINTR || errflag)
 	    return -1;
     }
     return STOUC(c);

-- 
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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: 3.1.5*: Re: [bug] Resizing an xterm while zsh queries the user
  1999-02-05 13:02 ` PATCH: 3.1.5*: Re: [bug] Resizing an xterm while zsh queries the user Peter Stephenson
@ 1999-02-13 14:35   ` Vincent Lefevre
  1999-02-13 14:29     ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Vincent Lefevre @ 1999-02-13 14:35 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh hackers list

On Fri, Feb 05, 1999 at 14:02:18 +0100, Peter Stephenson wrote:
> 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.
[snip]

It doesn't work very well. For instance:

$ echo blaj
zsh: correct 'blaj' to 'blah' [nyae]?

If I type Ctrl-C, it displays:

zsh: correct 'blaj' to 'blah' [nyae]? ^C

but still waits for a character. Then, if I type "y", it displays nothing
and "echo " goes to the history.

-- 
Vincent Lefevre <Vincent.Lefevre@ens-lyon.fr> - PhD stud. in Computer Science
Web: http://www.ens-lyon.fr/~vlefevre/ - 100% validated HTML - Acorn Risc PC,
Yellow Pig 17, Championnat International des Jeux Mathematiques et Logiques,
TETRHEX, Faits divers insolites, etc...


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-02-13 14:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <19990205124003.A26678@vin.ens-lyon.fr>
1999-02-05 13:02 ` PATCH: 3.1.5*: Re: [bug] Resizing an xterm while zsh queries the user Peter Stephenson
1999-02-13 14:35   ` Vincent Lefevre
1999-02-13 14:29     ` Peter Stephenson

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).