From bf9daef1280a1e34dca6c23bbf5ccfdbd93ff9ac Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Fri, 4 Mar 2022 12:46:31 -0600 Subject: term width hacking --- src/lib.lisp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/lib.lisp') diff --git a/src/lib.lisp b/src/lib.lisp index 1ddb103..070e021 100644 --- a/src/lib.lisp +++ b/src/lib.lisp @@ -520,12 +520,15 @@ the directories that appear in the value of that variable." (print results output)) (merge-into-cache results)) -(defvar *term-width* 80) +(defvar *term-width* nil) (defun set-term-width () + ;; tput cols b/c getenv COLUMNS wasnt working on some terminals (setf *term-width* - (or (parse-integer (uiop:run-program '("tput" "cols") :output :string) :junk-allowed t) - 80))) + (- + (or (parse-integer (uiop:run-program '("tput" "cols") :output :string) :junk-allowed t) + 80) + 4))) (defun print-oneliner-result-for-user (oneliner) (let* ((title-line-format-str @@ -582,6 +585,7 @@ the directories that appear in the value of that variable." (defun search-for-oneliners (terms limit not-flagged-p) (assert (loop for term in terms never (find #\, term) )) (set-term-width) + (format t "TERM WIDTH IS ~a~%" *term-width*) (ensure-config) (let ((response (api:request-with -- cgit v1.2.3