Repurpose test-raw.
This commit is contained in:
parent
7c3b3f3c6c
commit
7ef6d4fe9a
|
@ -147,15 +147,3 @@
|
|||
[(:: "\eO" any-char) (analyze-vt-O-key lexeme)]
|
||||
[(:: "\eO" numeric any-char) (analyze-vt-O-key lexeme)]
|
||||
))
|
||||
|
||||
(module+ main
|
||||
(require "private/tty-raw-extension")
|
||||
(tty-raw!)
|
||||
(let loop ()
|
||||
(match (lex-lcd-input (current-input-port))
|
||||
[(? eof-object?) (void)]
|
||||
[(== (C- #\D)) (void)]
|
||||
[key
|
||||
(printf "Key: ~v\r\n" key)
|
||||
(loop)]))
|
||||
(tty-restore!))
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
#lang racket/base
|
||||
|
||||
(require "private/tty-raw-extension")
|
||||
(require "ansi.rkt")
|
||||
(require "main.rkt")
|
||||
|
||||
(require racket/set)
|
||||
(require racket/match)
|
||||
|
||||
(define (main)
|
||||
(tty-raw!)
|
||||
|
@ -12,17 +15,15 @@
|
|||
(old-exit-handler v)))
|
||||
|
||||
(for-each display (list (set-mode x11-any-event-mouse-tracking-mode)))
|
||||
(flush-output)
|
||||
|
||||
(display "Type keys. Press control-D to exit.\r\n")
|
||||
(let loop ()
|
||||
(define ch (read-byte))
|
||||
(display (select-graphic-rendition ch))
|
||||
(display (clear-to-eol))
|
||||
(printf "Byte: ~v ~s\015\012" ch (integer->char ch))
|
||||
(display (select-graphic-rendition))
|
||||
;;(flush-output)
|
||||
(if (member ch '(4 8 127)) ;; EOF, C-h, DEL
|
||||
(exit)
|
||||
(loop))))
|
||||
(flush-output)
|
||||
(match (lex-lcd-input (current-input-port))
|
||||
[(? eof-object?) (void)]
|
||||
[(== (key #\D (set 'control))) (void)]
|
||||
[key
|
||||
(printf "Key: ~v\r\n" key)
|
||||
(loop)])))
|
||||
|
||||
(main)
|
||||
|
|
Loading…
Reference in New Issue