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)))
|
(rows (sb-alien:deref winsize 0)))
|
||||||
(values cols rows)))))
|
(values cols rows)))))
|
||||||
(sb-unix:unix-close tty-fd)))))
|
(sb-unix:unix-close tty-fd)))))
|
||||||
;; $COLUMNS/$LINES env vars — set by bash, may be available
|
;; MY_TERM_COLS/MY_TERM_LINES — set by the passepartout script
|
||||||
;; even when ioctl fails (SBCL strips them in some contexts
|
;; before exec sbcl. SBCL strips COLUMNS/LINES but leaves these.
|
||||||
;; but not all).
|
|
||||||
(ignore-errors
|
(ignore-errors
|
||||||
(let* ((cstr (sb-ext:posix-getenv "COLUMNS"))
|
(let* ((cstr (sb-ext:posix-getenv "MY_TERM_COLS"))
|
||||||
(rstr (sb-ext:posix-getenv "LINES"))
|
(rstr (sb-ext:posix-getenv "MY_TERM_LINES"))
|
||||||
(cols (when cstr (parse-integer cstr :junk-allowed t)))
|
(cols (when cstr (parse-integer cstr :junk-allowed t)))
|
||||||
(rows (when rstr (parse-integer rstr :junk-allowed t))))
|
(rows (when rstr (parse-integer rstr :junk-allowed t))))
|
||||||
(when (and cols rows (> cols 0) (> rows 0))
|
(when (and cols rows (> cols 0) (> rows 0))
|
||||||
|
|||||||
@@ -63,10 +63,10 @@
|
|||||||
(sb-alien:deref winsize 0))))
|
(sb-alien:deref winsize 0))))
|
||||||
(sb-alien:free-alien winsize))
|
(sb-alien:free-alien winsize))
|
||||||
(sb-unix:unix-close tty-fd)))))
|
(sb-unix:unix-close tty-fd)))))
|
||||||
;; $COLUMNS/$LINES env vars
|
;; MY_TERM_COLS/MY_TERM_LINES — set by the passepartout script.
|
||||||
(ignore-errors
|
(ignore-errors
|
||||||
(let* ((cstr (sb-ext:posix-getenv "COLUMNS"))
|
(let* ((cstr (sb-ext:posix-getenv "MY_TERM_COLS"))
|
||||||
(rstr (sb-ext:posix-getenv "LINES"))
|
(rstr (sb-ext:posix-getenv "MY_TERM_LINES"))
|
||||||
(cols (when cstr (parse-integer cstr :junk-allowed t)))
|
(cols (when cstr (parse-integer cstr :junk-allowed t)))
|
||||||
(rows (when rstr (parse-integer rstr :junk-allowed t))))
|
(rows (when rstr (parse-integer rstr :junk-allowed t))))
|
||||||
(when (and cols rows (> cols 0) (> rows 0))
|
(when (and cols rows (> cols 0) (> rows 0))
|
||||||
|
|||||||
Reference in New Issue
Block a user