v0.10.1: architectural cleanup — full-frame redraw, explicit bg everywhere, :bg-input fallback

- redraw: always draws all three views (status/chat/input) when any
  dirty flag is set. Dirty flags only gate frame rendering, not
  which parts render. Fixes disappearing input/history.
- Added :bg-input to all 13 presets with #2e2e2e (dark) / #d4d4d4
  (light-amber). theme-load fills missing keys from current preset
  defaults for backward compatibility.
- Removed unused *sidebar-panels* defvar and obsolete contract docs.
- Renamed dim-bg → dim-fg (foreground color, not background).
- All draw-text calls in sidebar and dialog minibuffer now pass
  explicit bg-panel, preventing background leaks.
- render-styled (markdown renderer) passes explicit (theme-color :bg).
- Fix h shadowing in view-chat scroll loop (h → mh).
This commit is contained in:
2026-05-16 09:03:59 -04:00
parent 0a0478f502
commit 2189745f40
3 changed files with 112 additions and 114 deletions

View File

@@ -1016,17 +1016,8 @@ Returns T on success, nil on failure. Does NOT wait or retry."
;; Guard w and h before render (resize or other code may have set them to nil)
(setq w (or (and (numberp w) (> w 0) w) 80)
h (or (and (numberp h) (> h 0) h) 24))
(when (and (or (first (st :dirty)) (second (st :dirty)) (third (st :dirty)))
(null (st :dialog-stack)))
(cl-tty.backend:begin-sync be)
(cl-tty.backend:draw-rect be 0 0 w h :bg (theme-color :bg))
(view-status be w h)
(view-chat be w h)
(view-input be w h)
(when (sidebar-visible-p w)
(view-sidebar be w h))
(cl-tty.backend:end-sync be)
(setf (st :dirty) (list nil nil nil)))
(unless (st :dialog-stack)
(redraw be w h))
(let ((ds (st :dialog-stack)))
(when ds
(cl-tty.backend:begin-sync be)
@@ -1038,42 +1029,42 @@ Returns T on success, nil on failure. Does NOT wait or retry."
(cnt (length filtered))
(filter (cl-tty.select:select-filter sel))
(mh (min 15 (+ 1 cnt)))
(top (max 0 (- h 4 mh)))
(top (max 0 (- h 7 mh)))
(bg-p (theme-color :bg-panel))
(sep-c (theme-color :separator)))
;; Fill minibuffer area with panel bg
(dotimes (r (min (- h 3 top) h))
(cl-tty.backend:draw-rect be 0 (+ top r) chat-w 1 :bg bg-p))
;; Top separator
(cl-tty.backend:draw-text be 0 top
(make-string chat-w :initial-element #\─)
sep-c nil)
(cl-tty.backend:draw-text be 1 top
(cl-tty.dialog:dialog-title dlg)
(theme-color :accent) nil)
;; Options
(let ((y-off 1))
(dolist (item filtered)
(let* ((display-idx (first item))
(option (third item))
(title (getf option :title))
(cat (getf option :category))
(sel-p (eql display-idx sel-idx))
(text (if cat (format nil " ~a" title)
(format nil " ~a~a" (if sel-p "▸ " " ") title)))
(row (+ top y-off)))
(when (>= row (1- h)) (return))
(cl-tty.backend:draw-text be 1 row text
(cond (cat (theme-color :text-muted))
(sel-p (theme-color :accent))
(t (theme-color :agent-fg)))
nil :bold sel-p)
(incf y-off))))
;; Filter prompt
(cl-tty.backend:draw-rect be 0 (- h 3) chat-w 1 :bg bg-p)
(cl-tty.backend:draw-text be 0 (- h 3)
(format nil "> ~a" (or filter ""))
(theme-color :input-prompt) nil))
;; Top separator
(cl-tty.backend:draw-text be 0 top
(make-string chat-w :initial-element #\─)
sep-c bg-p)
(cl-tty.backend:draw-text be 1 top
(cl-tty.dialog:dialog-title dlg)
(theme-color :accent) bg-p)
;; Options
(let ((y-off 1))
(dolist (item filtered)
(let* ((display-idx (first item))
(option (third item))
(title (getf option :title))
(cat (getf option :category))
(sel-p (eql display-idx sel-idx))
(text (if cat (format nil " ~a" title)
(format nil " ~a~a" (if sel-p "▸ " " ") title)))
(row (+ top y-off)))
(when (>= row (1- h)) (return))
(cl-tty.backend:draw-text be 1 row text
(cond (cat (theme-color :text-muted))
(sel-p (theme-color :accent))
(t (theme-color :agent-fg)))
bg-p :bold sel-p)
(incf y-off))))
;; Filter prompt
(cl-tty.backend:draw-rect be 0 (- h 3) chat-w 1 :bg bg-p)
(cl-tty.backend:draw-text be 0 (- h 3)
(format nil "> ~a" (or filter ""))
(theme-color :input-prompt) bg-p))
(cl-tty.backend:end-sync be))
(sleep 0.1)))
(progn (disconnect-daemon)))))