From f30362754f2f7cf4ccfd9260bbb46b3267fa11a0 Mon Sep 17 00:00:00 2001 From: Vivianne Langdon Date: Thu, 7 Mar 2024 08:22:28 -0500 Subject: [PATCH] Tweak --- scripts/examples/select-list.in | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/examples/select-list.in b/scripts/examples/select-list.in index 7351f77..5baf4c5 100644 --- a/scripts/examples/select-list.in +++ b/scripts/examples/select-list.in @@ -78,6 +78,8 @@ (define stdout (current-output-port)) +;; Set up the TTY in Raw mode, but cache pre-raw mode +;; for shutdown to restore terminal ;; not current-input-port, which is a soft port (define stdin (standard-input-port)) (define ts-old (make-termios-struct)) @@ -91,16 +93,18 @@ vat (define list (make-initial-list)) + (define (pre-render) + (cursor-up 7)) + (define (render str) - (cursor-up 7) (display str stdout)) (define io (spawn ^io (current-input-port) #:init (λ (input) - (with-vat vat - (on (<- list 'view) - (λ (str) (display str stdout))))) + (with-vat + vat + (on (<- list 'view) render))) #:cleanup (λ (input) (signal-condition! halted?) @@ -117,6 +121,7 @@ (when ch (let-on ((command (<- list 'update ch)) (str (<- list 'view))) + (pre-render) (render str) (if (eq? 'quit command) (<-np io 'halt)