(sigil tui terminal)
(sigil tui terminal) - Terminal control layer
Wraps native terminal primitives with Scheme-level conveniences for raw mode, alternate screen, mouse tracking, and terminal queries.
Exports
alternate-screen-onprocedureSwitch to the alternate screen buffer.
alternate-screen-offprocedureSwitch back to the normal screen buffer.
enable-mouse-trackingprocedureEnable SGR extended mouse tracking.
disable-mouse-trackingprocedureDisable mouse tracking.
terminal-columnsprocedureGet the number of terminal columns.
terminal-rowsprocedureGet the number of terminal rows.
with-terminalprocedureRun a thunk with the terminal in raw mode and alternate screen.
Sets up raw mode, alternate screen, and hidden cursor on entry. Restores everything on exit (normal or exception).
(with-terminal
(lambda ()
;; Terminal is in raw mode, alternate screen active
(terminal-write-raw "Hello from raw mode!")
(let loop ()
(let ((input (terminal-read-raw 64)))
(when input (loop))))))