v1.0.0 review fixes: dialog, textarea, scrollbox, demo, ASDF, layout
Fixes from subagent code review (15 findings): CRITICAL runtime bugs: - dialog.lisp: backend-write calls -> draw-rect/draw-text (wrong arg count) - dialog.lisp: removed undefined render-component call - dialog.lisp: toast render backend-write -> draw-text MAJOR data loss / silent failures: - textarea.lisp: undo overflow now drops oldest entry instead of wiping stack - scrollbox.lisp: :background-element -> :bright-black (theme keyword never resolved) ASDF completeness: - modern-tests.lisp wired as component and test-op suite - layout tests added to test-op suite list - markdown suite lookup now uses keyword (was looking up wrong string) - test runner updated to match API cleanup: - container-package: removed duplicate render export - select-package: removed duplicate render export - markdown.lisp: #\Escape -> #\Esc for consistency - textarea.lisp: removed duplicate %split-string defn Demo robustness: - Added unwind-protect for guaranteed terminal cleanup - Uses make-modern-backend constructor - Uses set-raw-mode/restore-terminal-state Layout: - normalize-box handles partial padding specs (was returning all zeros)
This commit is contained in:
@@ -9,5 +9,4 @@
|
||||
#:tab-bar #:make-tab-bar
|
||||
#:tab-bar-active #:tab-bar-tabs
|
||||
#:tab-bar-add #:tab-bar-next #:tab-bar-prev
|
||||
#:tab-bar-select #:tab-bar-handle-key
|
||||
#:render))
|
||||
#:tab-bar-select #:tab-bar-handle-key))
|
||||
|
||||
@@ -29,12 +29,16 @@
|
||||
(multiple-value-bind (dw dh) (dialog-size-pixels (dialog-size dialog))
|
||||
(let ((x (floor (- w dw) 2))
|
||||
(y (floor (- h dh) 2)))
|
||||
;; Backdrop — dim the full screen
|
||||
(dotimes (row h)
|
||||
(dotimes (col w)
|
||||
(backend-write screen col row " " :bg :dim)))
|
||||
(draw-rect screen 0 row w 1 :bg :bright-black))
|
||||
;; Dialog panel
|
||||
(draw-border screen x y dw dh :single :title (dialog-title dialog))
|
||||
(when (dialog-content dialog)
|
||||
(render-component (dialog-content dialog) screen (1+ x) (1+ y) (- dw 2) (- dh 2))))))
|
||||
;; Content rendering delegated to component system
|
||||
(draw-text screen (1+ x) (1+ y)
|
||||
(format nil "~a" (dialog-content dialog))
|
||||
:white :default)))))
|
||||
|
||||
(defun push-dialog (dialog)
|
||||
(push dialog *dialog-stack*)
|
||||
@@ -108,7 +112,7 @@
|
||||
(concatenate 'string (subseq msg 0 (- max-w 5)) "...")
|
||||
msg)))
|
||||
(draw-rect screen x 0 max-w 1 :bg color)
|
||||
(backend-write screen (1+ x) 0 text :fg :white :bold t)))
|
||||
(draw-text screen (1+ x) 0 text :white color :bold t)))
|
||||
|
||||
(defun toast (message &key (variant :info) (duration 5000))
|
||||
(let ((toast (make-instance 'toast :message message :variant variant)))
|
||||
|
||||
@@ -518,7 +518,7 @@
|
||||
(:keyword "33") (:builtin "36")
|
||||
(:function "34") (:comment "2") (:string "32") (:number "35")
|
||||
(t nil))))
|
||||
(if code (format nil "~c[~am~a~c[0m" #\Escape code token #\Escape) token)))
|
||||
(if code (format nil "~c[~am~a~c[0m" #\Esc code token #\Esc) token)))
|
||||
|
||||
(defun apply-highlight-style (char-vector)
|
||||
(coerce char-vector 'string))
|
||||
@@ -568,7 +568,7 @@
|
||||
((string= style "blue") "34") ((string= style "magenta") "35")
|
||||
((string= style "white") "37") ((string= style "black") "30")
|
||||
(t nil))))
|
||||
(if code (format nil "~c[~am~a~c[0m" #\Escape code text #\Escape) text)))
|
||||
(if code (format nil "~c[~am~a~c[0m" #\Esc code text #\Esc) text)))
|
||||
|
||||
(defun render-inline (children)
|
||||
(if (null children) ""
|
||||
@@ -641,7 +641,7 @@
|
||||
(:added "32") (:removed "31")
|
||||
(:hunk-header "36") (:file-header "1;36") (t nil))))
|
||||
(if color
|
||||
(push (format nil "~c[~am~a~c[0m" #\Escape color line #\Escape) result)
|
||||
(push (format nil "~c[~am~a~c[0m" #\Esc color line #\Esc) result)
|
||||
(push line result))))
|
||||
(nreverse result)))
|
||||
|
||||
|
||||
@@ -64,12 +64,12 @@
|
||||
(when (> content-h viewport-h)
|
||||
(let* ((thumb (scrollbar-thumb sy viewport-h content-h))
|
||||
(thumb-pos (round (* thumb viewport-h))))
|
||||
(draw-rect backend (1- viewport-w) 0 1 viewport-h :bg :background-element)
|
||||
(draw-rect backend (1- viewport-w) 0 1 viewport-h :bg :bright-black)
|
||||
(draw-text backend (1- viewport-w) thumb-pos "█" nil nil)))
|
||||
(when (> content-w viewport-w)
|
||||
(let* ((thumb (scrollbar-thumb sx viewport-w content-w))
|
||||
(thumb-pos (round (* thumb viewport-w))))
|
||||
(draw-rect backend 0 (1- viewport-h) viewport-w 1 :bg :background-element)
|
||||
(draw-rect backend 0 (1- viewport-h) viewport-w 1 :bg :bright-black)
|
||||
(draw-text backend thumb-pos (1- viewport-h) "█" nil nil)))))
|
||||
|
||||
(defun update-sticky-scroll (sb)
|
||||
|
||||
@@ -9,5 +9,4 @@
|
||||
#:select-next #:select-prev
|
||||
#:select-visible-options
|
||||
#:select-handle-key
|
||||
#:render
|
||||
#:fuzzy-match-p))
|
||||
|
||||
@@ -1,16 +1,5 @@
|
||||
(in-package #:cl-tty.input)
|
||||
|
||||
;;; ---------------------------------------------------------------------------
|
||||
;;; Utility: split string (local copy for dependency-free operation)
|
||||
;;; ---------------------------------------------------------------------------
|
||||
(defun %split-string (string separator)
|
||||
"Split STRING at each occurrence of SEPARATOR. Returns list of strings."
|
||||
(loop with start = 0
|
||||
for pos = (position separator string :start start)
|
||||
collect (subseq string start pos)
|
||||
while pos
|
||||
do (setf start (1+ pos))))
|
||||
|
||||
;;; ---------------------------------------------------------------------------
|
||||
;;; Textarea class
|
||||
;;; ---------------------------------------------------------------------------
|
||||
@@ -169,10 +158,10 @@
|
||||
"Save current value on undo stack."
|
||||
(let ((stack (textarea-undo-stack ta)))
|
||||
(when (>= (length stack) (array-total-size stack))
|
||||
(setf (textarea-undo-stack ta)
|
||||
(make-array 100 :fill-pointer 0)))
|
||||
(loop for i from 1 below (length stack)
|
||||
do (setf (aref stack (1- i)) (aref stack i)))
|
||||
(decf (fill-pointer stack)))
|
||||
(vector-push (textarea-value ta) stack)
|
||||
;; Clear redo stack on new action
|
||||
(setf (fill-pointer (textarea-redo-stack ta)) 0)))
|
||||
|
||||
(defun textarea-undo (ta)
|
||||
|
||||
Reference in New Issue
Block a user