diff --git a/org/text-input.org b/org/text-input.org index 10b2c8c..f6c5615 100644 --- a/org/text-input.org +++ b/org/text-input.org @@ -704,7 +704,6 @@ All the complexity lives in ~%read-event~ and its callees. #+BEGIN_SRC lisp :tangle ../src/components/input.lisp (defmethod read-event ((b cl-tty.backend:backend) &key timeout) - (declare (ignore b)) ;; Check for pending terminal resize before reading input. ;; The SIGWINCH handler sets *terminal-resized-p* asynchronously. (when *terminal-resized-p* diff --git a/src/backend/classes.lisp b/src/backend/classes.lisp index 5c3e426..d103806 100644 --- a/src/backend/classes.lisp +++ b/src/backend/classes.lisp @@ -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.") (: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) "Execute BODY with a fully initialized terminal backend. @@ -39,8 +39,8 @@ Example: (c-sym (gensym "COLS")) (r-sym (gensym "ROWS"))) `(let* ((,be-sym (detect-backend)) - (,c-sym (nth-value 0 (backend-size ,be-sym))) - (,r-sym (nth-value 1 (backend-size ,be-sym)))) + ,@(when cols-var `((,c-sym (nth-value 0 (backend-size ,be-sym))))) + ,@(when rows-var `((,r-sym (nth-value 1 (backend-size ,be-sym)))))) (initialize-backend ,be-sym) (unwind-protect (let ((,backend-var ,be-sym) diff --git a/src/components/input.lisp b/src/components/input.lisp index ba3c76c..f546ed6 100644 --- a/src/components/input.lisp +++ b/src/components/input.lisp @@ -186,7 +186,6 @@ (setf *terminal-resized-p* t)))) (defmethod read-event ((b cl-tty.backend:backend) &key timeout) - (declare (ignore b)) ;; Check for pending terminal resize before reading input. ;; The SIGWINCH handler sets *terminal-resized-p* asynchronously. (when *terminal-resized-p*