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

Bug in zsh 3.0.0


I just found this:

zsh>  ^D                                                (space and ^D)
zsh: do you wish to see all 1344 possibilities? ÿ       (^C)

I expected that it would echo "n", not "ÿ" (ÿ is 0xFF in ISO-8859-1).

The problem is in getzlequery() in zle_utils.c where getkey() is
called, but EOF is not checked for.

*** zle_utils.c,DIST    Sat Aug  3 00:08:55 1996
--- zle_utils.c Mon Sep 16 13:31:03 1996
*** 327,332 ****
--- 327,334 ----
        c = 'y';
      else if (icntrl(c))
	c = 'n';
+     else if (c == EOF)
+	c = 'n';
	c = tulower(c);


While looking at getkey() in zle_main.c I found that it can return
EOF, -1, or a key. It is extremely common for EOF to be -1, so what
is the intention with having getkey() return both EOF and -1?

Shouldn't this
	return (r <= 0) ? -1 : cc;
be changed into this?
	return (r <= 0) ? EOF : cc;

Or should my patch above also check for -1 (for machines where EOF
is not -1)?

 Goran Larsson                        mailto:hoh@xxxxxxxxxx
 I was an atheist,                    http://home1.swipnet.se/%7Ew-12153/
 until I found out I was God.

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