Marc
On Sep 4, 2019, at 11:34 AM, John Cowan <cowan@ccil.org> wrote:
The buffering setting has to do with buffering within the Scheme process, whereas the tty setting has to do with buffering within the operating system. In order to get single-character reads from the terminal, you have to turn off both.
Indeed. The tty settings can be changed by calling tty-mode-set! as shown below. Marc ;;; File: console-read-one-char-at-a-time.scm ;; run like this: ;; ;; gsi console-read-one-char-at-a-time.scm (define (setup port) (if (tty? port) ;; change the tty settings to read raw characters 1 at a time (tty-mode-set! port #f ;; input-allow-special #f ;; input-echo #t ;; input-raw #f ;; output-raw 0))) ;; speed (define port (current-input-port)) (setup port) (let loop () (let ((c (read-char port))) (pp (list 'typed c)) (loop)))