fix: multi-value backend-size, minibuffer border+width, pre-existing warnings

- backend-size: nested multiple-value-bind/values instead of or+mv-bind
  (or discards secondary values), remove stale env-var pre-check
- Minibuffer: full chat-w width (respects sidebar), horizontal rule
  border, clear filter prompt line to avoid text overlap
- Filter prompt: (or filter "") prevents "NIL" display
- Dirty-flag redraw: skip when dialog-stack is non-nil (minibuffer
  covers the area, prevents flicker)
- Remove 3 unused variables: FOCUS, SENSOR, C (pre-existing warnings)
This commit is contained in:
2026-05-15 08:51:19 -04:00
parent f56ff4849f
commit c148570d4c

View File

@@ -209,7 +209,6 @@ Event handlers + daemon I/O + main loop.
;; /context command — section breakdown with token estimates
((string-equal text "/context")
(let* ((msg-count (length (st :messages)))
(focus (or (st :foveal-id) "none"))
(id-tokens (min 200 (floor (+ 150 (length (or (st :focus-scope) ""))) 4)))
(tool-tokens (if (boundp 'passepartout::*cognitive-tool-registry*)
(floor (* (hash-table-count passepartout::*cognitive-tool-registry*) 40) 4)
@@ -642,7 +641,6 @@ supplied (e.g. \"/\"), pre-fill the select filter with it."
(msg-type (getf msg :type))
(action (getf payload :action))
(level (getf msg :level))
(sensor (getf payload :sensor))
(gate-trace (getf msg :gate-trace))
(rule-count (getf payload :rule-count))
(foveal-id (getf payload :foveal-id)))
@@ -769,6 +767,7 @@ supplied (e.g. \"/\"), pre-fill the select filter with it."
:name "tui-reader")
(return-from connect-daemon t))
(usocket:connection-refused-error (c)
(declare (ignore c))
(when (= attempt 3)
(add-msg :system (format nil "* No daemon on port ~a after ~a attempts *"
port attempt))))
@@ -994,7 +993,8 @@ supplied (e.g. \"/\"), pre-fill the select filter with it."
;; Guard w and h before render (resize or other code may have set them to nil)
(setq w (or (and (numberp w) (> w 0) w) 80)
h (or (and (numberp h) (> h 0) h) 24))
(when (or (first (st :dirty)) (second (st :dirty)) (third (st :dirty)))
(when (and (or (first (st :dirty)) (second (st :dirty)) (third (st :dirty)))
(null (st :dialog-stack)))
(let* ((sidebar-w (if (and (st :sidebar-visible) (>= w 60))
(or (st :sidebar-width) 30) 0))
(chat-w (- w sidebar-w)))
@@ -1013,21 +1013,26 @@ supplied (e.g. \"/\"), pre-fill the select filter with it."
(let ((ds (st :dialog-stack)))
(when ds
(cl-tty.backend:begin-sync be)
(let* ((dlg (car ds))
(let* ((sidebar-w (if (and (st :sidebar-visible) (>= w 60))
(or (st :sidebar-width) 30) 0))
(chat-w (- w sidebar-w))
(dlg (car ds))
(sel (cl-tty.dialog:dialog-content dlg))
(filtered (cl-tty.select:select-filtered-options sel))
(sel-idx (cl-tty.select:select-selected-index sel))
(cnt (length filtered))
(filter (cl-tty.select:select-filter sel))
;; Bottom-anchored: filter at h-3, options above
(mh (min 15 (+ 1 cnt))) ;; +1 for title
(top (max 0 (- h 3 mh))))
;; Clear the full minibuffer area (top to h-2)
(dotimes (r (min (- h 2 top) h))
(cl-tty.backend:draw-rect be 0 (+ top r) w 1
(top (max 0 (- h 4 mh))))
;; Clear the minibuffer area
(dotimes (r (min (- h 3 top) h))
(cl-tty.backend:draw-rect be 0 (+ top r) chat-w 1
:bg (theme-color :status-bg)))
;; Title line
;; Top border line with title
(cl-tty.backend:draw-text be 0 top
(make-string chat-w :initial-element #\─)
(theme-color :separator) nil)
(cl-tty.backend:draw-text be 1 top
(cl-tty.dialog:dialog-title dlg)
(theme-color :accent) nil)
;; Options
@@ -1049,8 +1054,10 @@ supplied (e.g. \"/\"), pre-fill the select filter with it."
nil :bold sel-p)
(incf y-off))))
;; Filter prompt at h-3
(cl-tty.backend:draw-rect be 0 (- h 3) chat-w 1
:bg (theme-color :status-bg))
(cl-tty.backend:draw-text be 0 (- h 3)
(format nil "> ~a" filter)
(format nil "> ~a" (or filter ""))
(theme-color :input-prompt) nil))
(cl-tty.backend:end-sync be))
(sleep 0.1))