From 36fbe8144111a703752df199a2b203e1c20f4ceb Mon Sep 17 00:00:00 2001 From: Amr Gharbeia Date: Thu, 14 May 2026 14:55:37 -0400 Subject: [PATCH] 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. --- src/backend/modern.lisp | 9 ++++----- src/backend/simple.lisp | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/backend/modern.lisp b/src/backend/modern.lisp index 7f806b6..8d34192 100644 --- a/src/backend/modern.lisp +++ b/src/backend/modern.lisp @@ -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)) diff --git a/src/backend/simple.lisp b/src/backend/simple.lisp index 47f103f..d6df6d5 100644 --- a/src/backend/simple.lisp +++ b/src/backend/simple.lisp @@ -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))