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:
@@ -581,9 +581,9 @@ supplied (e.g. \"/\"), pre-fill the select filter with it."
|
||||
(send-daemon (list :type :event :payload val))
|
||||
(add-msg :system (format nil "Sent: ~a" (getf opt :title)))
|
||||
(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
|
||||
(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)))
|
||||
(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)))
|
||||
((member ch '(:up :down))
|
||||
(if (eql ch :up)
|
||||
(cl-tty.select:select-prev sel)
|
||||
(cl-tty.select:select-next sel)))
|
||||
(cl-tty.dialog:select-prev sel)
|
||||
(cl-tty.dialog:select-next sel)))
|
||||
((member ch '(:enter))
|
||||
(let* ((filtered (cl-tty.select:select-filtered-options sel))
|
||||
(idx (cl-tty.select:select-selected-index sel))
|
||||
(let* ((filtered (cl-tty.dialog:select-filtered-options sel))
|
||||
(idx (cl-tty.dialog:select-selected-index sel))
|
||||
(item (when (< idx (length filtered))
|
||||
(third (nth idx filtered)))))
|
||||
(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))))))
|
||||
((let ((chr (if (characterp ch) ch (code-char ch))))
|
||||
(and chr (graphic-char-p chr))
|
||||
(setf (cl-tty.select:select-filter sel)
|
||||
(setf (cl-tty.dialog:select-filter sel)
|
||||
(concatenate 'string
|
||||
(or (cl-tty.select:select-filter sel) "")
|
||||
(or (cl-tty.dialog:select-filter sel) "")
|
||||
(string chr)))))
|
||||
((member ch '(:backspace))
|
||||
(let ((f (cl-tty.select:select-filter sel)))
|
||||
(let ((f (cl-tty.dialog:select-filter sel)))
|
||||
(when (> (length f) 0)
|
||||
(setf (cl-tty.select:select-filter sel)
|
||||
(setf (cl-tty.dialog:select-filter sel)
|
||||
(subseq f 0 (1- f))))))))
|
||||
(on-key ch))))))))
|
||||
;; 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)))
|
||||
(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))
|
||||
(filtered (cl-tty.dialog:select-filtered-options sel))
|
||||
(sel-idx (cl-tty.dialog:select-selected-index sel))
|
||||
(cnt (length filtered))
|
||||
(filter (cl-tty.select:select-filter sel))
|
||||
(filter (cl-tty.dialog:select-filter sel))
|
||||
(mh (min 15 (+ 1 cnt)))
|
||||
(panel-top (passepartout.channel-tui:input-panel-top chat-w h))
|
||||
(top (max 0 (- panel-top mh)))
|
||||
|
||||
Reference in New Issue
Block a user