fix: constrain separator/input/status to chat area when sidebar visible
Added chat-w = w - sidebar_width calculation in view-status and view-input, matching view-chat's existing approach. Also added chat-w for the separator line drawing in tui-main. This prevents the prompt, separator, hint, and status bar from extending into the sidebar area when it's visible.
This commit is contained in:
@@ -1022,16 +1022,19 @@ Event handlers + daemon I/O + main loop.
|
||||
(setq w (or (and (numberp w) (> w 0) w) 80)
|
||||
h (or (and (numberp h) (> h 0) h) 24))
|
||||
(when (or (first (st :dirty)) (second (st :dirty)) (third (st :dirty)))
|
||||
(cl-tty.backend:backend-clear be)
|
||||
(view-status be w h)
|
||||
(view-chat be w h)
|
||||
;; Draw separator line above input
|
||||
(cl-tty.backend:draw-text be 0 (- h 4) (make-string w :initial-element #\─)
|
||||
(theme-color :separator) nil)
|
||||
(view-input be w h)
|
||||
(when (and (st :sidebar-visible) (>= w 60))
|
||||
(view-sidebar be w h))
|
||||
(setf (st :dirty) (list nil nil nil)))
|
||||
(let* ((sidebar-w (if (and (st :sidebar-visible) (>= w 60))
|
||||
(or (st :sidebar-width) 30) 0))
|
||||
(chat-w (- w sidebar-w)))
|
||||
(cl-tty.backend:backend-clear be)
|
||||
(view-status be w h)
|
||||
(view-chat be w h)
|
||||
;; Draw separator line above input
|
||||
(cl-tty.backend:draw-text be 0 (- h 4) (make-string chat-w :initial-element #\─)
|
||||
(theme-color :separator) nil)
|
||||
(view-input be w h)
|
||||
(when (and (st :sidebar-visible) (>= w 60))
|
||||
(view-sidebar be w h))
|
||||
(setf (st :dirty) (list nil nil nil))))
|
||||
(let ((ds (st :dialog-stack)))
|
||||
(when ds
|
||||
(let* ((dlg (car ds))
|
||||
|
||||
@@ -60,7 +60,9 @@ Returns a list of strings, one per line."
|
||||
|
||||
(defun view-status (fb w h)
|
||||
(let* ((w (or (and (numberp w) (> w 0) w) 80))
|
||||
(h (or (and (numberp h) (> h 0) h) 24))
|
||||
(h (or (and (numberp h) (> h 0) h) 24))
|
||||
(sidebar-w (if (and (st :sidebar-visible) (>= w 60)) (or (st :sidebar-width) 30) 0))
|
||||
(chat-w (- w sidebar-w))
|
||||
(bg (theme-color :status-bg))
|
||||
(fg (theme-color :status-fg))
|
||||
(ver (st :daemon-version))
|
||||
@@ -72,10 +74,9 @@ Returns a list of strings, one per line."
|
||||
(length (st :messages))
|
||||
(or (st :rule-count) 0)))
|
||||
(right (format nil "$~,2f ~a" (or (st :session-cost) 0.0) (now))))
|
||||
(dotimes (col w)
|
||||
(cl-tty.backend:draw-text fb 0 (- h 1) (make-string w :initial-element #\Space) nil bg))
|
||||
(cl-tty.backend:draw-rect fb 0 (- h 1) chat-w 1 :bg bg)
|
||||
(cl-tty.backend:draw-text fb 1 (- h 1) left fg nil)
|
||||
(cl-tty.backend:draw-text fb (- w (length right) 2) (- h 1) right fg nil)))
|
||||
(cl-tty.backend:draw-text fb (- chat-w (length right) 2) (- h 1) right fg nil)))
|
||||
|
||||
|
||||
;; v0.7.2: search-highlight — wrap matching text in **bold** for markdown
|
||||
@@ -219,10 +220,12 @@ Returns a list of strings, one per line."
|
||||
(defun view-input (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 60)) (or (st :sidebar-width) 30) 0))
|
||||
(chat-w (- w sidebar-w))
|
||||
(text (input-string))
|
||||
(pos (or (st :cursor-pos) 0))
|
||||
(display-start (max 0 (- pos (1- w))))
|
||||
(visible (subseq text display-start (min (length text) (+ display-start w)))))
|
||||
(display-start (max 0 (- pos (1- chat-w))))
|
||||
(visible (subseq text display-start (min (length text) (+ display-start chat-w)))))
|
||||
(cl-tty.backend:draw-text fb 0 (- h 2) (format nil " Ctrl+P palette | Up/Dn history | Tab complete")
|
||||
(theme-color :hint) nil)
|
||||
(cl-tty.backend:draw-text fb 0 (- h 3) (format nil "> ~a" visible) (theme-color :input-fg) nil)))
|
||||
|
||||
Reference in New Issue
Block a user