Lisp HUG Maillist Archive

Intercepting key presses in listener

Hi there,

have a look at this bit of code:

(defun input nil
   (loop for char = (read-char)
         do (write-char char)))

What it is supposed to do is wait until the user presses a key displaying  
it in the standard output afterwards. Yet there is a trouble---not only  
(write-char char) displays the input character but (read-char) does that  
too. So, for example, if we want to type into the listener

LISPWORKS

instead we get

LLIISSPPWWOORRKKSS

which is lovely but not quite what we need. So the question is, how does  
one go about reading a key press in the listener without displaying it  
back but rather generating our own output?


Updated at: 2020-12-10 08:40 UTC