diff --git a/ansi/lcd-terminal.rkt b/ansi/lcd-terminal.rkt index 53dfeee..6442f09 100644 --- a/ansi/lcd-terminal.rkt +++ b/ansi/lcd-terminal.rkt @@ -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) diff --git a/ansi/test-screen-size.rkt b/ansi/test-screen-size.rkt new file mode 100644 index 0000000..c925426 --- /dev/null +++ b/ansi/test-screen-size.rkt @@ -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))