fix: re-query backend-size before initial render

The first backend-size query may return 80x24 before the terminal
settles. Re-query immediately before the initial render to pick up
the actual terminal dimensions.
This commit is contained in:
2026-05-14 10:12:31 -04:00
parent ec38589237
commit a8f8d841a4

View File

@@ -868,6 +868,9 @@
(let ((backend-type (if (typep be 'cl-tty.backend:modern-backend)
"modern" "simple")))
(add-msg :system (format nil "* ~a backend ~dx~d *" backend-type w h)))
;; Re-query terminal size before initial render (the first
;; query may return 80x24 before the terminal settles)
(multiple-value-setq (w h) (cl-tty.backend:backend-size be))
;; Initial render
(cl-tty.backend:backend-clear be)
(view-status be w h)
@@ -884,7 +887,6 @@
(setf (st :connected) nil
(st :busy) nil)
(add-msg :system "* Connection lost — type /reconnect to retry *"))))
;; Read key input via cl-tty read-event (10ms timeout)
;; Read key input via blocking read-char with 0.1s timeout
;; (sb-unix:unix-simple-poll returns NIL on fd 0 in this SBCL,
;; so read-char-no-hang and read-event never fire. Raw blocking