fix: add word-wrap function, complete TUI migration
- Add missing word-wrap function (was declared in contract but never defined) - TUI now renders correctly: draw-text on framebuffer arrays works - Daemon connection verified - All three view functions (status, chat, input) call draw-text correctly
This commit is contained in:
@@ -45,12 +45,25 @@ that the TUI actuator attaches to the response plist before transmission.
|
||||
#+BEGIN_SRC lisp :tangle ../lisp/channel-tui-view.lisp
|
||||
(in-package :passepartout.channel-tui)
|
||||
|
||||
(defun word-wrap (text width)
|
||||
"Wrap TEXT to at most WIDTH columns. Splits on word boundaries.
|
||||
Returns a list of strings, one per line."
|
||||
(let ((lines nil))
|
||||
(loop while (> (length text) width)
|
||||
do (let ((break (or (position #\Space text :end width :from-end t)
|
||||
width)))
|
||||
(push (subseq text 0 break) lines)
|
||||
(setf text (string-left-trim '(#\Space)
|
||||
(subseq text break)))))
|
||||
(push text lines)
|
||||
(nreverse lines)))
|
||||
|
||||
(defun view-status (fb w)
|
||||
(let ((degraded (and (find-package :passepartout)
|
||||
(boundp (find-symbol "*SYSTEM-HEALTH*" :passepartout))
|
||||
(member (symbol-value (find-symbol "*SYSTEM-HEALTH*" :passepartout))
|
||||
'(:degraded :unhealthy))))
|
||||
(bg (if degraded :bright-yellow nil)))
|
||||
(let* ((degraded (and (find-package :passepartout)
|
||||
(boundp (find-symbol "*SYSTEM-HEALTH*" :passepartout))
|
||||
(member (symbol-value (find-symbol "*SYSTEM-HEALTH*" :passepartout))
|
||||
'(:degraded :unhealthy))))
|
||||
(bg (if degraded :bright-yellow nil)))
|
||||
;; Line 1: Connection, mode, msgs, scroll, rules, streaming/busy
|
||||
(cl-tty.backend:draw-text fb 1 1
|
||||
(format nil " Passepartout ~a [~a] msgs:~a scroll:~a Rules:~a~a"
|
||||
|
||||
Reference in New Issue
Block a user