fix: TUI crash on keypress — config inner cond extra paren

Root cause: config inner cond had )))) (4 closes) but needed ))) (3).
The 4th ) prematurely closed the outer cond config clause, making
(t (cond ...)) a bare function call to T instead of the cond default.

Also fixed chat-render coordinate bug (:y 1 :x y -> :y y :x 1)
Added backtrace diag (handler-bind all errors, sb-debug to stderr)
Added asdf central-registry push + :force t for stale-cache prevention
This commit is contained in:
2026-05-04 13:42:44 -04:00
parent d1951668cc
commit 8a7259c5c8
3 changed files with 24 additions and 19 deletions

View File

@@ -3,6 +3,8 @@
(:export :tui-main))
(in-package :passepartout.gateway-tui)
(declaim (optimize (debug 3) (safety 3) (speed 0)))
(defvar *stream* nil "TCP stream to daemon")
(defvar *input-buffer* nil "Current input line as reversed char list")
(defvar *input-history* nil "Sent messages (newest first)")
@@ -126,8 +128,8 @@
(text (cdr entry))
(prefix (if (eq dir :sent) "⬆" "⬇"))
(label (format nil "~a [~a] ~a" prefix (timestamp) text)))
(add-string win label :y 1 :x y)
(incf y))))))
(add-string win label :y y :x 1)
(incf y))))))
(refresh win))
(defun input-render (win)
@@ -318,12 +320,12 @@
(config-render-cascade config-win))
((eql ch #\3)
(config-render-models config-win))
((eql ch #\4)
(config-render-view config-win))))
(status-render status-win))
;; Chat mode key handling
(t
(cond
((eql ch #\4)
(config-render-view config-win)))
(status-render status-win))
;; Chat mode key handling
(t
(cond
;; Enter/Return submit
((or (eql ch 10) (eql ch 13) (eq ch :enter) (eql ch #\Newline) (eql ch #\Return))
(setf *chat-scroll-pos* 0)
@@ -367,7 +369,7 @@
(let ((converted (code-char ch)))
(when (and converted (graphic-char-p converted))
(push converted *input-buffer*)
(input-render input-win))))))))
(input-render input-win)))))))))
(refresh scr)
(sleep 0.01))
(disconnect-daemon))))

View File

@@ -28,6 +28,8 @@ The TUI Client is a Croatoan-based ncurses chat interface for Passepartout. It c
(:export :tui-main))
(in-package :passepartout.gateway-tui)
(declaim (optimize (debug 3) (safety 3) (speed 0)))
(defvar *stream* nil "TCP stream to daemon")
(defvar *input-buffer* nil "Current input line as reversed char list")
(defvar *input-history* nil "Sent messages (newest first)")
@@ -163,8 +165,8 @@ The TUI Client is a Croatoan-based ncurses chat interface for Passepartout. It c
(text (cdr entry))
(prefix (if (eq dir :sent) "⬆" "⬇"))
(label (format nil "~a [~a] ~a" prefix (timestamp) text)))
(add-string win label :y 1 :x y)
(incf y))))))
(add-string win label :y y :x 1)
(incf y))))))
(refresh win))
(defun input-render (win)
@@ -364,12 +366,12 @@ The TUI Client is a Croatoan-based ncurses chat interface for Passepartout. It c
(config-render-cascade config-win))
((eql ch #\3)
(config-render-models config-win))
((eql ch #\4)
(config-render-view config-win))))
(status-render status-win))
;; Chat mode key handling
(t
(cond
((eql ch #\4)
(config-render-view config-win)))
(status-render status-win))
;; Chat mode key handling
(t
(cond
;; Enter/Return submit
((or (eql ch 10) (eql ch 13) (eq ch :enter) (eql ch #\Newline) (eql ch #\Return))
(setf *chat-scroll-pos* 0)
@@ -413,7 +415,7 @@ The TUI Client is a Croatoan-based ncurses chat interface for Passepartout. It c
(let ((converted (code-char ch)))
(when (and converted (graphic-char-p converted))
(push converted *input-buffer*)
(input-render input-win))))))))
(input-render input-win)))))))))
(refresh scr)
(sleep 0.01))
(disconnect-daemon))))

View File

@@ -372,12 +372,13 @@ case "$COMMAND" in
fi
exec sbcl \
--eval '(load (merge-pathnames "quicklisp/setup.lisp" (user-homedir-pathname)))' \
--eval '(declaim (optimize (debug 3) (speed 0) (safety 3)))' \
--eval "(push (truename \"$PASSEPARTOUT_DATA_DIR/\") asdf:*central-registry*)" \
--eval '(ql:quickload :passepartout/tui :force t)' \
--eval '(in-package :passepartout)' \
--eval "(load (format nil \"~alisp/system-model-provider.lisp\" (truename \"$PASSEPARTOUT_DATA_DIR/\")))" \
--eval "(load (format nil \"~alisp/system-model-explorer.lisp\" (truename \"$PASSEPARTOUT_DATA_DIR/\")))" \
--eval '(handler-bind ((undefined-function (lambda (c) (format t "~%Undefined function: ~a~%" (cell-error-name c)) (sb-debug:print-backtrace :count 20) (finish-output) (uiop:quit 1)))) (passepartout.gateway-tui:tui-main))'
--eval '(handler-bind ((error (lambda (c) (format t "~%CRASH: ~a~%" c) (sb-debug:print-backtrace :count 30 :stream *error-output*) (finish-output) (finish-output *error-output*) (uiop:quit 1)))) (passepartout.gateway-tui:tui-main))'
;;
gateway)
SUBCMD=$1; PLATFORM=$2; TOKEN=$3