v0.10.4: spacer rows between messages in history area
Clean implementation: spacer inserted in the rendering loop as an (incf y) between message blocks, tracked in scroll-fitting loop via spacer variable. No data structure changes. Also: fixed premature let close in spacer binding, fixed view-input closing paren count, and re-applied speaker alignment fixes lost in revert.
This commit is contained in:
@@ -170,24 +170,28 @@ Returns a list of strings, one per line."
|
||||
(let ((msg-count 0) (lines-remaining max-lines))
|
||||
(loop for i from (1- total) downto 0
|
||||
while (> lines-remaining 0)
|
||||
do (let ((mh (aref msg-heights i)))
|
||||
(if (<= mh lines-remaining)
|
||||
(progn (decf lines-remaining mh) (incf msg-count))
|
||||
do (let ((mh (aref msg-heights i))
|
||||
(spacer (if (< i (1- total)) 1 0)))
|
||||
(if (<= (+ mh spacer) lines-remaining)
|
||||
(progn (decf lines-remaining (+ mh spacer)) (incf msg-count))
|
||||
(setf lines-remaining 0))))
|
||||
(let* ((scroll-skip (st :scroll-offset))
|
||||
(start (max 0 (- total msg-count scroll-skip))))
|
||||
(loop for i from start below total while (< y (- h 7))
|
||||
do (let ((pairs (aref msg-lines i)))
|
||||
(dolist (pair pairs)
|
||||
(when (>= y (- h 7)) (return))
|
||||
(destructuring-bind (bstr bcolor tstr tcolor &optional rect-bg) pair
|
||||
(when rect-bg
|
||||
(cl-tty.backend:draw-rect fb 0 y 1 1 :bg rect-bg))
|
||||
(let ((has-border (and bstr (> (length bstr) 0))))
|
||||
(when has-border
|
||||
(cl-tty.backend:draw-text fb hpad y bstr bcolor nil))
|
||||
(cl-tty.backend:draw-text fb (+ hpad (if has-border 2 0)) y tstr tcolor nil)))
|
||||
(incf y)))))))))
|
||||
(loop for i from start below total while (< y (- h 7))
|
||||
do (let ((pairs (aref msg-lines i)))
|
||||
(dolist (pair pairs)
|
||||
(when (>= y (- h 7)) (return))
|
||||
(destructuring-bind (bstr bcolor tstr tcolor &optional rect-bg) pair
|
||||
(when rect-bg
|
||||
(cl-tty.backend:draw-rect fb 0 y 1 1 :bg rect-bg))
|
||||
(let ((has-border (and bstr (> (length bstr) 0))))
|
||||
(when has-border
|
||||
(cl-tty.backend:draw-text fb hpad y bstr bcolor nil))
|
||||
(cl-tty.backend:draw-text fb (+ hpad (if has-border 2 0)) y tstr tcolor nil)))
|
||||
(incf y))
|
||||
;; spacer between message blocks
|
||||
(when (< i (1- total))
|
||||
(incf y)))))))))
|
||||
#+END_SRC
|
||||
|
||||
** Input Line
|
||||
@@ -209,11 +213,11 @@ Returns a list of strings, one per line."
|
||||
(hint-fg (theme-color :hint)))
|
||||
;; Light grey input panel: h-7 to h-4 (4 rows), indented by hpad
|
||||
(cl-tty.backend:draw-rect fb hpad (- h 7) inner-w 4 :bg bg-i)
|
||||
;; Speaker line for all 4 input rows
|
||||
;; Speaker line for all 4 input rows (at hpad, matching history)
|
||||
(dolist (r (list (- h 7) (- h 6) (- h 5) (- h 4)))
|
||||
(cl-tty.backend:draw-text fb 0 r "│" (theme-color :input-prompt) nil))
|
||||
;; Prompt at h-6, second row at h-5 (placeholder for expansion)
|
||||
(cl-tty.backend:draw-text fb hpad (- h 6) visible input-fg nil)
|
||||
(cl-tty.backend:draw-text fb hpad r "│" (theme-color :input-prompt) nil))
|
||||
;; Prompt at h-6, second row at h-5 — text at hpad+2 matching history
|
||||
(cl-tty.backend:draw-text fb (+ hpad 2) (- h 6) visible input-fg nil)
|
||||
;; Hint — lowercase, right-aligned at h-2
|
||||
(let ((hint "ctrl+p | /help"))
|
||||
(cl-tty.backend:draw-text fb (- chat-w (length hint) 2) (- h 2) hint hint-fg (theme-color :bg)))))
|
||||
@@ -299,7 +303,7 @@ Returns a list of strings, one per line."
|
||||
(pos (or (st :cursor-pos) 0))
|
||||
(prompt-w (- cw (* 2 hpad) 2))
|
||||
(display-start (max 0 (- pos (1- prompt-w))))
|
||||
(cx (+ hpad (- pos display-start)))
|
||||
(cx (+ hpad 2 (- pos display-start)))
|
||||
(cy (- h 6)))
|
||||
(cl-tty.backend:cursor-move fb cx cy)
|
||||
(cl-tty.backend:cursor-style fb :block :blink t)
|
||||
|
||||
Reference in New Issue
Block a user