fix: use MY_TERM_COLS/LINES instead of COLUMNS/LINES
SBCL unconditionally strips COLUMNS and LINES from the environment. MY_TERM_COLS/MY_TERM_LINES bypass this filter.
This commit is contained in:
@@ -205,12 +205,11 @@ as a fallback when a keyword is not in *named-colors*.")
|
||||
(rows (sb-alien:deref winsize 0)))
|
||||
(values cols rows)))))
|
||||
(sb-unix:unix-close tty-fd)))))
|
||||
;; $COLUMNS/$LINES env vars — set by bash, may be available
|
||||
;; even when ioctl fails (SBCL strips them in some contexts
|
||||
;; but not all).
|
||||
;; MY_TERM_COLS/MY_TERM_LINES — set by the passepartout script
|
||||
;; before exec sbcl. SBCL strips COLUMNS/LINES but leaves these.
|
||||
(ignore-errors
|
||||
(let* ((cstr (sb-ext:posix-getenv "COLUMNS"))
|
||||
(rstr (sb-ext:posix-getenv "LINES"))
|
||||
(let* ((cstr (sb-ext:posix-getenv "MY_TERM_COLS"))
|
||||
(rstr (sb-ext:posix-getenv "MY_TERM_LINES"))
|
||||
(cols (when cstr (parse-integer cstr :junk-allowed t)))
|
||||
(rows (when rstr (parse-integer rstr :junk-allowed t))))
|
||||
(when (and cols rows (> cols 0) (> rows 0))
|
||||
|
||||
@@ -63,10 +63,10 @@
|
||||
(sb-alien:deref winsize 0))))
|
||||
(sb-alien:free-alien winsize))
|
||||
(sb-unix:unix-close tty-fd)))))
|
||||
;; $COLUMNS/$LINES env vars
|
||||
;; MY_TERM_COLS/MY_TERM_LINES — set by the passepartout script.
|
||||
(ignore-errors
|
||||
(let* ((cstr (sb-ext:posix-getenv "COLUMNS"))
|
||||
(rstr (sb-ext:posix-getenv "LINES"))
|
||||
(let* ((cstr (sb-ext:posix-getenv "MY_TERM_COLS"))
|
||||
(rstr (sb-ext:posix-getenv "MY_TERM_LINES"))
|
||||
(cols (when cstr (parse-integer cstr :junk-allowed t)))
|
||||
(rows (when rstr (parse-integer rstr :junk-allowed t))))
|
||||
(when (and cols rows (> cols 0) (> rows 0))
|
||||
|
||||
Reference in New Issue
Block a user