fix: demo uses backend-size instead of hardcoded 80x24

This commit is contained in:
Hermes Agent
2026-05-12 14:04:51 +00:00
parent b38436038b
commit b0ede26bff

View File

@@ -125,8 +125,12 @@
./demo.sh shell wrapper." ./demo.sh shell wrapper."
(init-app-state) (init-app-state)
(let* ((backend (detect-backend)) (let* ((backend (detect-backend))
(w 80) (h 24)) (w (multiple-value-bind (cols rows) (backend-size backend)
(declare (ignore h)) (declare (ignore rows))
cols))
(h (multiple-value-bind (cols rows) (backend-size backend)
(declare (ignore cols))
rows)))
(initialize-backend backend) (initialize-backend backend)
(unwind-protect (unwind-protect
(loop while (getf *app* :running) (loop while (getf *app* :running)
@@ -146,19 +150,19 @@
(draw-text backend x-pos 4 label :text-muted nil)))) (draw-text backend x-pos 4 label :text-muted nil))))
;; Content area ;; Content area
(case (getf *app* :tab) (case (getf *app* :tab)
(0 (render-tab-home backend 4 6 72 20)) (0 (render-tab-home backend 4 6 (- w 4) (- h 8)))
(1 (render-tab-widgets backend 4 6 72 24 (1 (render-tab-widgets backend 4 6 (- w 4) (- h 8)
(getf *app* :input) (getf *app* :input)
(getf *app* :textarea))) (getf *app* :textarea)))
(2 (render-tab-console backend 4 6 72 16))) (2 (render-tab-console backend 4 6 (- w 4) (- h 8))))
;; Mouse cursor indicator ;; Mouse cursor indicator
(let ((mx (getf *app* :mouse-x)) (let ((mx (getf *app* :mouse-x))
(my (getf *app* :mouse-y))) (my (getf *app* :mouse-y)))
(when (and (>= mx 0) (>= my 0)) (when (and (>= mx 0) (>= my 0))
(draw-text backend mx my "@" :bright-cyan nil))) (draw-text backend mx my "@" :bright-cyan nil)))
;; Status bar ;; Status bar
(draw-rect backend 2 23 (- w 4) 1 :bg :blue) (draw-rect backend 2 (- h 2) (- w 4) 1 :bg :blue)
(draw-text backend 4 23 (draw-text backend 4 (- h 2)
(format nil " Tab ~d/3 | ~d events " (format nil " Tab ~d/3 | ~d events "
(1+ (getf *app* :tab)) (length *log*)) (1+ (getf *app* :tab)) (length *log*))
:bright-white :blue :bold t) :bright-white :blue :bold t)