From a8f8d841a4c031324927b42cd13db751d1427347 Mon Sep 17 00:00:00 2001 From: Amr Gharbeia Date: Thu, 14 May 2026 10:12:31 -0400 Subject: [PATCH] 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. --- lisp/channel-tui-main.lisp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/channel-tui-main.lisp b/lisp/channel-tui-main.lisp index 3760b00..93347a2 100644 --- a/lisp/channel-tui-main.lisp +++ b/lisp/channel-tui-main.lisp @@ -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