Demo fancy output and raw input at the same time

This commit is contained in:
Tony Garnock-Jones 2011-12-19 16:03:45 -05:00
parent c3d9c0d6ad
commit b1f22df932
1 changed files with 6 additions and 1 deletions

View File

@ -1,12 +1,17 @@
#lang racket/base #lang racket/base
(require "tty-raw-extension") (require "tty-raw-extension")
(require "ansi.rkt")
(define (main) (define (main)
(tty-raw!) (tty-raw!)
(let loop () (let loop ()
(define ch (read-byte)) (define ch (read-byte))
(printf "Byte: ~v\015\012" ch) (display (select-graphic-rendition ch))
(printf "Byte: ~v" ch)
(display (clear-to-eol))
(display "\015\012")
(display (select-graphic-rendition))
;;(flush-output) ;;(flush-output)
(if (member ch '(4 8 127)) ;; EOF, C-h, DEL (if (member ch '(4 8 127)) ;; EOF, C-h, DEL
(exit) (exit)