fix: move stty size to first priority in backend-size
stty size via subprocess is the most reliable method — it returns the correct 59x83 from the user's terminal. Move it before ioctl to ensure it's tried first.
This commit is contained in:
@@ -22,7 +22,19 @@
|
||||
(values))
|
||||
|
||||
(defmethod backend-size ((b simple-backend))
|
||||
(or (ignore-errors
|
||||
(or ;; stty size via subprocess — most reliable across all systems.
|
||||
(ignore-errors
|
||||
(let* ((out (uiop:run-program '("sh" "-c" "stty size < /dev/tty")
|
||||
:output :string
|
||||
:ignore-error-status t))
|
||||
(parts (and out (uiop:split-string
|
||||
(string-trim '(#\newline #\space) out)))))
|
||||
(when (and parts (= (length parts) 2))
|
||||
(let ((rows (parse-integer (first parts) :junk-allowed t))
|
||||
(cols (parse-integer (second parts) :junk-allowed t)))
|
||||
(when (and rows cols (> rows 0) (> cols 0))
|
||||
(values cols rows))))))
|
||||
(ignore-errors
|
||||
(let* ((+tiocgwinsz+ 21523)
|
||||
(winsize (sb-alien:make-alien sb-alien:unsigned-short 4)))
|
||||
(unwind-protect
|
||||
|
||||
Reference in New Issue
Block a user