v1.0.0: TUI support — resize events, with-terminal macro
This commit is contained in:
@@ -704,7 +704,6 @@ All the complexity lives in ~%read-event~ and its callees.
|
|||||||
|
|
||||||
#+BEGIN_SRC lisp :tangle ../src/components/input.lisp
|
#+BEGIN_SRC lisp :tangle ../src/components/input.lisp
|
||||||
(defmethod read-event ((b cl-tty.backend:backend) &key timeout)
|
(defmethod read-event ((b cl-tty.backend:backend) &key timeout)
|
||||||
(declare (ignore b))
|
|
||||||
;; Check for pending terminal resize before reading input.
|
;; Check for pending terminal resize before reading input.
|
||||||
;; The SIGWINCH handler sets *terminal-resized-p* asynchronously.
|
;; The SIGWINCH handler sets *terminal-resized-p* asynchronously.
|
||||||
(when *terminal-resized-p*
|
(when *terminal-resized-p*
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ Called before SIGTSTP or similar suspension. Application should redraw after res
|
|||||||
Called after SIGCONT or similar resume. Re-enables raw mode and backend features.")
|
Called after SIGCONT or similar resume. Re-enables raw mode and backend features.")
|
||||||
(:method ((b backend)) (values)))
|
(:method ((b backend)) (values)))
|
||||||
|
|
||||||
(defmacro with-terminal ((backend-var &optional (cols-var (gensym)) (rows-var (gensym)))
|
(defmacro with-terminal ((backend-var &optional cols-var rows-var)
|
||||||
&body body)
|
&body body)
|
||||||
"Execute BODY with a fully initialized terminal backend.
|
"Execute BODY with a fully initialized terminal backend.
|
||||||
|
|
||||||
@@ -39,8 +39,8 @@ Example:
|
|||||||
(c-sym (gensym "COLS"))
|
(c-sym (gensym "COLS"))
|
||||||
(r-sym (gensym "ROWS")))
|
(r-sym (gensym "ROWS")))
|
||||||
`(let* ((,be-sym (detect-backend))
|
`(let* ((,be-sym (detect-backend))
|
||||||
(,c-sym (nth-value 0 (backend-size ,be-sym)))
|
,@(when cols-var `((,c-sym (nth-value 0 (backend-size ,be-sym)))))
|
||||||
(,r-sym (nth-value 1 (backend-size ,be-sym))))
|
,@(when rows-var `((,r-sym (nth-value 1 (backend-size ,be-sym))))))
|
||||||
(initialize-backend ,be-sym)
|
(initialize-backend ,be-sym)
|
||||||
(unwind-protect
|
(unwind-protect
|
||||||
(let ((,backend-var ,be-sym)
|
(let ((,backend-var ,be-sym)
|
||||||
|
|||||||
@@ -186,7 +186,6 @@
|
|||||||
(setf *terminal-resized-p* t))))
|
(setf *terminal-resized-p* t))))
|
||||||
|
|
||||||
(defmethod read-event ((b cl-tty.backend:backend) &key timeout)
|
(defmethod read-event ((b cl-tty.backend:backend) &key timeout)
|
||||||
(declare (ignore b))
|
|
||||||
;; Check for pending terminal resize before reading input.
|
;; Check for pending terminal resize before reading input.
|
||||||
;; The SIGWINCH handler sets *terminal-resized-p* asynchronously.
|
;; The SIGWINCH handler sets *terminal-resized-p* asynchronously.
|
||||||
(when *terminal-resized-p*
|
(when *terminal-resized-p*
|
||||||
|
|||||||
Reference in New Issue
Block a user