This commit is contained in:
Vivianne 2024-03-07 08:22:28 -05:00
parent 95200be30b
commit f30362754f
Signed by: vv
GPG Key ID: F3E249EDFAC7BE26
1 changed files with 9 additions and 4 deletions

View File

@ -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)