fix: lower sidebar threshold to 60 cols, word-wrap agent messages
- Sidebar threshold lowered from 120 to 60 so it works on 83-col terminals - Agent response text is now word-wrapped through cl-tty.box:word-wrap after markdown rendering, preventing text from bleeding past the terminal edge
This commit is contained in:
@@ -98,7 +98,7 @@ Returns a list of strings, one per line."
|
||||
(defun view-chat (fb w h)
|
||||
(let* ((w (or (and (numberp w) (> w 0) w) 80))
|
||||
(h (or (and (numberp h) (> h 0) h) 24))
|
||||
(sidebar-w (if (and (st :sidebar-visible) (>= w 120))
|
||||
(sidebar-w (if (and (st :sidebar-visible) (>= w 60))
|
||||
(or (st :sidebar-width) 30) 0))
|
||||
(chat-w (- w sidebar-w))
|
||||
(msgs (st :messages)) (total (length msgs))
|
||||
@@ -136,7 +136,8 @@ Returns a list of strings, one per line."
|
||||
(hdr-str (format nil "~a~a" hdr
|
||||
(make-string (max 0 (- chat-w (length hdr))) :initial-element #\─)))
|
||||
(nodes (cl-tty.markdown:parse-blocks cs))
|
||||
(body (or (and nodes (cl-tty.markdown:render-md nodes)) (list ""))))
|
||||
(raw-body (or (and nodes (cl-tty.markdown:render-md nodes)) (list "")))
|
||||
(body (mapcan (lambda (l) (cl-tty.box:word-wrap l (- chat-w 2))) raw-body)))
|
||||
(push (list hdr-str (theme-color :agent-header)) pairs)
|
||||
(dolist (l body) (push (list l (theme-color :agent-fg)) pairs))))
|
||||
(t (dolist (l (cl-tty.box:word-wrap cs (- chat-w 2)))
|
||||
@@ -283,7 +284,7 @@ Returns a list of strings, one per line."
|
||||
(when sd (view-status fb w h))
|
||||
(when cd (view-chat fb w h))
|
||||
(when id (view-input fb w h))
|
||||
(when (and (st :sidebar-visible) (>= w 120))
|
||||
(when (and (st :sidebar-visible) (>= w 60))
|
||||
(view-sidebar fb w h))
|
||||
(setf (st :dirty) (list nil nil nil))))
|
||||
#+END_SRC
|
||||
@@ -591,7 +592,7 @@ ASCII < 128 = 1. CJK, fullwidth, emoji = 2. Combining marks = 0. Tab = 8."
|
||||
;; If view-sidebar were called with a nil fb it would error; this verifies
|
||||
;; the guard in redraw protects the call.
|
||||
(let ((fb nil) (w 100) (h 24))
|
||||
(is (not (and (passepartout.channel-tui::st :sidebar-visible) (>= w 120))))))
|
||||
(is (not (and (passepartout.channel-tui::st :sidebar-visible) (>= w 60))))))
|
||||
|
||||
(test test-status-bar-tokens
|
||||
"v0.9.0: status bar uses :status-fg and :status-bg theme tokens."
|
||||
|
||||
Reference in New Issue
Block a user