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

Re: typeahead problem

Andrej Borsenkow wrote:
> >
> > In Linux and AIX 4.2 there is no difference in the behaviour whether or
> > not I define CLOBBERS_TYPEAHEAD in config.h. Hm, is that the right
> > location? I also added "x-*-linux*" to the switch in the "TYPEAHEAD
> > KLUDGE" section in configure.in, but that didn't change anything either.
> >
> Sorry, it is unrelated to typeahead probleam, I had to read better :(
> I tried it here with 3.1.5 + patches. It looks, like ZSH takes the first
> character on the line and ignores the rest.
> while read -q && sleep 10
> do
> echo YES
> done
> y <- cursor immediately springs to the next line
> yyyYES
>       ^^^ output by ZSH
> <- note newline
> Only first 'y' from 'yyy' is taken. Is it what you've seen?

No. For example, try this script:

  for i in {1..}
  do if read -q "REPLY?y/n: "
     then print yes
     else print no
     sleep 1

After the first prompt, type aa quickly (or any other characters). On
Linux and AIX, I get

  y/n: a
  ay/n: n
  ay/n: n
  ay/n: n
  ay/n: n
  $ a

where $ stands for the shell prompt.

I guess the problem is getzlequery() in Zle/zle_utils.c. The comment
says: "If there are any characters in the buffer, this is taken as a
negative response, and no characters are read." This sounds like an
exact description of what happens, and doesn't seem to make much sense.
Why aren't the characters in the buffer read?? OTOH, there is no such
bug on HP-UP, so I hesitate to hack the sources blindly...


Bernd Eggink
Regionales Rechenzentrum der Uni Hamburg

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