v0.8.0: replace custom dialog stack with cl-tty.dialog:*dialog-stack*

- (st :dialog-stack) → cl-tty.dialog:*dialog-stack*
- (pop (st :dialog-stack)) → (cl-tty.dialog:pop-dialog)
- (push dlg (st :dialog-stack)) → (cl-tty.dialog:push-dialog dlg)
- All 10 references replaced across on-key, unified-menu-show, main loop, render, and tests
This commit is contained in:
2026-05-18 13:28:31 -04:00
parent 5524b4de06
commit 5797e43cd8

View File

@@ -563,7 +563,7 @@ Event handlers + daemon I/O + main loop.
(when (and chr (graphic-char-p chr))
(input-insert-char chr)
(setf (st :dirty) (list nil nil t))
(when (and (char= chr #\/) (null (st :dialog-stack))
(when (and (char= chr #\/) (null cl-tty.dialog:*dialog-stack*)
(= (length (st :input-buffer)) 1))
(unified-menu-show "/"))))))))
@@ -572,7 +572,7 @@ Event handlers + daemon I/O + main loop.
"Open the command minibuffer with ALL commands. If INITIAL-FILTER is
supplied (e.g. \"/\"), pre-fill the select filter with it."
(let* ((on-select (lambda (opt)
(pop (st :dialog-stack))
(cl-tty.dialog:pop-dialog)
(let ((val (getf opt :value)))
(cond ((stringp val)
;; Slash command — fill input buffer
@@ -588,7 +588,7 @@ supplied (e.g. \"/\"), pre-fill the select filter with it."
(when initial-filter
(setf (cl-tty.select:select-filter sel) initial-filter))
(let ((dlg (make-instance 'cl-tty.dialog:dialog :title "Commands" :content sel)))
(push dlg (st :dialog-stack)))))
(cl-tty.dialog:push-dialog dlg))))
;; v0.7.2 — resolve-hitl-panel: marks panel as resolved after approve/deny
(defun resolve-hitl-panel (decision)
@@ -944,12 +944,12 @@ Returns T on success, nil on failure. Does NOT wait or retry."
(:hidden :auto)))
(setf (st :dirty) (list t t t)))
(:CTRL-L (setf (st :dirty) (list t t t)))
(t (if (st :dialog-stack)
(let* ((dlg (car (st :dialog-stack)))
(sel (cl-tty.dialog:dialog-content dlg)))
(cond
((eql ch :escape)
(pop (st :dialog-stack))
(t (if cl-tty.dialog:*dialog-stack*
(let* ((dlg (car cl-tty.dialog:*dialog-stack*))
(sel (cl-tty.dialog:dialog-content dlg)))
(cond
((eql ch :escape)
(cl-tty.dialog:pop-dialog)
(setf (st :dirty) (list t t nil)))
((member ch '(:up :down))
(if (eql ch :up)
@@ -1020,9 +1020,9 @@ Returns T on success, nil on failure. Does NOT wait or retry."
;; 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))
(unless (st :dialog-stack)
(redraw be w h))
(let ((ds (st :dialog-stack)))
(unless cl-tty.dialog:*dialog-stack*
(redraw be w h))
(let ((ds cl-tty.dialog:*dialog-stack*))
(when ds
(cl-tty.backend:begin-sync be)
(let* ((chat-w (- w (if (sidebar-visible-p w) (or (st :sidebar-width) 42) 0)))
@@ -1079,7 +1079,7 @@ Returns T on success, nil on failure. Does NOT wait or retry."
(cl-tty.backend:end-sync be))
(sleep 0.1)
;; Show terminal cursor at input position every frame
(unless (st :dialog-stack)
(unless cl-tty.dialog:*dialog-stack*
(passepartout.channel-tui:position-cursor be w h))))
(progn (disconnect-daemon)))))
#+END_SRC
@@ -1579,7 +1579,7 @@ Returns T on success, nil on failure. Does NOT wait or retry."
(fiveam:test test-minibuffer-state
"Contract v0.8.0: init-state has :dialog-stack and :minibuffer-active fields."
(init-state)
(fiveam:is (null (st :dialog-stack)))
(fiveam:is (null cl-tty.dialog:*dialog-stack*))
(fiveam:is (null (st :minibuffer-active))))
(fiveam:test test-command-palette-state