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

Re: typeahead problem



Bart Schaefer wrote:
 
> The question is which of those two cases `read -q` should emulate.  The
> decision made was to treat it like spell checking, leaving the typeahead
> alone when possible so that other commands may consume it.  

IMHO this decision was wrong, but it's probabely too late now. The
situation when I noticed that behaviour was in a loop consisting of
about 100 successive 'read -q' queries. ONE false move, and ALL
remaining questions get the answer 'no'. This can have very harmful
consequences, whereas not being able to type something in advance for
the next command is just a minor inconvenience.

> The way you
> get the "always consume one character" behavior is to use
> 
>         read -k1 "REPLY?Yes or no: " && do_something

Hm, no. You have to write something like

	typeset -u REPLY
	read -k1 "REPLY?Yes or no: "
	[[ $REPLY == Y ]] && do_something

But apart from that you're right, of course.

Regards,
Bernd 

--
Bernd Eggink
Regionales Rechenzentrum der Uni Hamburg
eggink@xxxxxxxxxxxxxx
http://www.rrz.uni-hamburg.de/eggink/BEggink.html



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