Tweak guard; small demo

This commit is contained in:
Tony Garnock-Jones 2018-08-13 09:32:01 +01:00
parent f415faab55
commit d3f1e04bd7
2 changed files with 26 additions and 1 deletions

View File

@ -126,7 +126,8 @@
["c" (S- 'right)]
["d" (S- 'left)]
["h" #:when (equal? params '(4)) (simple-key 'insert)] ;; st, http://st.suckless.org/
["t" #:when (equal? (car params) 8) (apply screen-size-report (cdr params))]
["t" #:when (and (= (length params) 3) (= (car params) 8))
(apply screen-size-report (cdr params))]
[_ (simple-key (unknown-escape-sequence lexeme))]))
(define (analyze-vt-O-mainchar lexeme mainchar)

24
ansi/test-screen-size.rkt Normal file
View File

@ -0,0 +1,24 @@
#lang racket/base
(require "main.rkt")
(define (display* . things)
(for-each display things)
(flush-output))
(define (main)
(tty-raw!)
(display* (dec-soft-terminal-reset)
(device-request-screen-size))
(define report (lex-lcd-input (current-input-port)))
(printf "The reported screen size is ~a columns and ~a rows.\r\n"
(screen-size-report-columns report)
(screen-size-report-rows report))
(printf "The raw report value itself is ~v.\r\n" report)
(display* (dec-soft-terminal-reset)))
(module+ main
(main))