fix dialog navigation and sidebar data construction

Dialog: use consistent cl-tty.dialog: prefix for all select accessors.
The :cl-tty.select and :cl-tty.dialog packages each define their own
SELECT class with separate accessor generic functions. Mixing prefixes
caused "no applicable method" errors. Now all 14 references use
cl-tty.dialog: (make-select, select-filter, select-next, etc.)

Sidebar: fix sidebar-lines append arguments. Each item must be a
proper list of cons cells, not a bare cons. Replaced all quoted
'("x" . :y) with (list (cons "x" :y)). Also fixed the quoted
cons call that was never evaluated.

Bash script: add --disable-debugger and --eval '(uiop:quit 0)' to
the tui sbcl invocation. Prevents the debugger from entering raw
terminal mode on error and ensures clean exit.

cl-tty: delete stale select-package.lisp and select.lisp orphan files
(not tangled by any current org file).
This commit is contained in:
2026-05-20 12:07:56 -04:00
parent 9492e00318
commit 0629f8c6d3
3 changed files with 32 additions and 31 deletions

View File

@@ -581,9 +581,9 @@ supplied (e.g. \"/\"), pre-fill the select filter with it."
(send-daemon (list :type :event :payload val)) (send-daemon (list :type :event :payload val))
(add-msg :system (format nil "Sent: ~a" (getf opt :title))) (add-msg :system (format nil "Sent: ~a" (getf opt :title)))
(setf (st :dirty) (list t t nil))))))) (setf (st :dirty) (list t t nil)))))))
(sel (cl-tty.select:make-select :options (all-commands) :on-select on-select))) (sel (cl-tty.dialog:make-select :options (all-commands) :on-select on-select)))
(when initial-filter (when initial-filter
(setf (cl-tty.select:select-filter sel) initial-filter)) (setf (cl-tty.dialog:select-filter sel) initial-filter))
(let ((dlg (make-instance 'cl-tty.dialog:dialog :title "Commands" :content sel))) (let ((dlg (make-instance 'cl-tty.dialog:dialog :title "Commands" :content sel)))
(push dlg (st :dialog-stack))))) (push dlg (st :dialog-stack)))))
@@ -987,26 +987,26 @@ Returns T on success, nil on failure. Does NOT wait or retry."
(setf (st :dirty) (list t t nil))) (setf (st :dirty) (list t t nil)))
((member ch '(:up :down)) ((member ch '(:up :down))
(if (eql ch :up) (if (eql ch :up)
(cl-tty.select:select-prev sel) (cl-tty.dialog:select-prev sel)
(cl-tty.select:select-next sel))) (cl-tty.dialog:select-next sel)))
((member ch '(:enter)) ((member ch '(:enter))
(let* ((filtered (cl-tty.select:select-filtered-options sel)) (let* ((filtered (cl-tty.dialog:select-filtered-options sel))
(idx (cl-tty.select:select-selected-index sel)) (idx (cl-tty.dialog:select-selected-index sel))
(item (when (< idx (length filtered)) (item (when (< idx (length filtered))
(third (nth idx filtered))))) (third (nth idx filtered)))))
(when item (when item
(let ((cb (cl-tty.select:select-on-select sel))) (let ((cb (cl-tty.dialog:select-on-select sel)))
(when cb (funcall cb item)))))) (when cb (funcall cb item))))))
((let ((chr (if (characterp ch) ch (code-char ch)))) ((let ((chr (if (characterp ch) ch (code-char ch))))
(and chr (graphic-char-p chr)) (and chr (graphic-char-p chr))
(setf (cl-tty.select:select-filter sel) (setf (cl-tty.dialog:select-filter sel)
(concatenate 'string (concatenate 'string
(or (cl-tty.select:select-filter sel) "") (or (cl-tty.dialog:select-filter sel) "")
(string chr))))) (string chr)))))
((member ch '(:backspace)) ((member ch '(:backspace))
(let ((f (cl-tty.select:select-filter sel))) (let ((f (cl-tty.dialog:select-filter sel)))
(when (> (length f) 0) (when (> (length f) 0)
(setf (cl-tty.select:select-filter sel) (setf (cl-tty.dialog:select-filter sel)
(subseq f 0 (1- f)))))))) (subseq f 0 (1- f))))))))
(on-key ch)))))))) (on-key ch))))))))
;; Keyboard reader via cl-tty.input:read-event (handles CSI, SS3, UTF-8, resize) ;; Keyboard reader via cl-tty.input:read-event (handles CSI, SS3, UTF-8, resize)
@@ -1033,10 +1033,10 @@ Returns T on success, nil on failure. Does NOT wait or retry."
(let* ((chat-w (- w (if (sidebar-visible-p w) (or (st :sidebar-width) 42) 0))) (let* ((chat-w (- w (if (sidebar-visible-p w) (or (st :sidebar-width) 42) 0)))
(dlg (car ds)) (dlg (car ds))
(sel (cl-tty.dialog:dialog-content dlg)) (sel (cl-tty.dialog:dialog-content dlg))
(filtered (cl-tty.select:select-filtered-options sel)) (filtered (cl-tty.dialog:select-filtered-options sel))
(sel-idx (cl-tty.select:select-selected-index sel)) (sel-idx (cl-tty.dialog:select-selected-index sel))
(cnt (length filtered)) (cnt (length filtered))
(filter (cl-tty.select:select-filter sel)) (filter (cl-tty.dialog:select-filter sel))
(mh (min 15 (+ 1 cnt))) (mh (min 15 (+ 1 cnt)))
(panel-top (passepartout.channel-tui:input-panel-top chat-w h)) (panel-top (passepartout.channel-tui:input-panel-top chat-w h))
(top (max 0 (- panel-top mh))) (top (max 0 (- panel-top mh)))

View File

@@ -217,10 +217,10 @@ and current sidebar mode (:auto/:visible/:hidden)."
(dotimes (r panel-rows) (dotimes (r panel-rows)
(cl-tty.backend:draw-text fb hpad (+ panel-top r) "│" (theme-color :input-prompt) nil)) (cl-tty.backend:draw-text fb hpad (+ panel-top r) "│" (theme-color :input-prompt) nil))
;; Render text-input widget (word-wrap + cursor) ;; Render text-input widget (word-wrap + cursor)
(let ((ln (make-layout-node))) (let ((ln (cl-tty.layout:make-layout-node)))
(setf (layout-node-x ln) (+ hpad 2) (setf (cl-tty.layout:layout-node-x ln) (+ hpad 2)
(layout-node-y ln) (1+ panel-top) (cl-tty.layout:layout-node-y ln) (1+ panel-top)
(layout-node-width ln) prompt-w) (cl-tty.layout:layout-node-width ln) prompt-w)
(setf (cl-tty.input:text-input-layout-node input) ln) (setf (cl-tty.input:text-input-layout-node input) ln)
(cl-tty.box:render input fb)) (cl-tty.box:render input fb))
;; Hint bar at h-2 ;; Hint bar at h-2
@@ -266,7 +266,7 @@ and current sidebar mode (:auto/:visible/:hidden)."
(dot-color (if (st :connected) :dot-connected :dot-disconnected))) (dot-color (if (st :connected) :dot-connected :dot-disconnected)))
(append (append
;; Gate Trace ;; Gate Trace
'("GATE TRACE" . :accent) (list (cons "GATE TRACE" :accent))
(if last-gt (if last-gt
(mapcan (lambda (g) (mapcan (lambda (g)
(let* ((name (getf g :gate)) (let* ((name (getf g :gate))
@@ -283,23 +283,23 @@ and current sidebar mode (:auto/:visible/:hidden)."
(cons (format nil " ~a" reason) :dim)) (cons (format nil " ~a" reason) :dim))
(list (cons (format nil " ~a ~a" glyph name) color))))) (list (cons (format nil " ~a ~a" glyph name) color)))))
last-gt) last-gt)
'((cons " (none)" :dim))) (list (cons " (none)" :dim)))
;; Rules ;; Rules
'("" nil) (list (cons "" nil))
'("RULES" . :accent) (list (cons "RULES" :accent))
(list (cons (format nil " ~d active" (or (st :rule-count) 0)) :agent-fg)) (list (cons (format nil " ~d active" (or (st :rule-count) 0)) :agent-fg))
(list (cons (format nil " ~d blocked" blocked) (list (cons (format nil " ~d blocked" blocked)
(if (> blocked 0) :error :dim))) (if (> blocked 0) :error :dim)))
;; Cost ;; Cost
'("" nil) (list (cons "" nil))
'("COST" . :accent) (list (cons "COST" :accent))
(list (cons (format nil " $~,2f" (or (st :session-cost) 0.0)) :status-fg)) (list (cons (format nil " $~,2f" (or (st :session-cost) 0.0)) :status-fg))
;; Files ;; Files
'("" nil) (list (cons "" nil))
'("FILES" . :accent) (list (cons "FILES" :accent))
'(" (not yet)" . :dim) (list (cons " (not yet)" :dim))
;; spacer ;; spacer
'("" nil) (list (cons "" nil))
;; Version footer — rendered at h-2, not in the loop ;; Version footer — rendered at h-2, not in the loop
(list (cons (format nil "~a ~a" dot ver-label) dot-color))))) (list (cons (format nil "~a ~a" dot ver-label) dot-color)))))

View File

@@ -395,13 +395,14 @@ case "$COMMAND" in
stty -icanon -echo -ixon 2>/dev/null || true stty -icanon -echo -ixon 2>/dev/null || true
# Ensure COLORTERM is set for modern backend detection # Ensure COLORTERM is set for modern backend detection
export COLORTERM="${COLORTERM:-truecolor}" export COLORTERM="${COLORTERM:-truecolor}"
sbcl --noinform \ sbcl --noinform --disable-debugger \
--load "$HOME/quicklisp/setup.lisp" \ --load "$HOME/quicklisp/setup.lisp" \
--eval '(push (truename "'"$PASSEPARTOUT_DATA_DIR"'/") asdf:*central-registry*)' \ --eval '(push (truename "'"$PASSEPARTOUT_DATA_DIR"'/") asdf:*central-registry*)' \
--eval '(setf *debugger-hook* nil uiop:*compile-file-failure-behaviour* :warn)' \ --eval '(setf *debugger-hook* nil uiop:*compile-file-failure-behaviour* :warn)' \
--eval '(ql:quickload :passepartout/tui)' \ --eval '(ql:quickload :passepartout/tui)' \
--eval '(in-package :passepartout)' \ --eval '(in-package :passepartout)' \
--eval '(passepartout.channel-tui:tui-main)' --eval '(passepartout.channel-tui:tui-main)' \
--eval '(uiop:quit 0)'
rc=$? rc=$?
stty icanon echo ixon 2>/dev/null stty icanon echo ixon 2>/dev/null
exit $rc exit $rc