From 3ce7f9949c038193cc691b6c65d43ea927316953 Mon Sep 17 00:00:00 2001 From: Hermes Date: Mon, 11 May 2026 22:01:36 +0000 Subject: [PATCH] =?UTF-8?q?Fix=20all=2013=20layout=20test=20failures=20?= =?UTF-8?q?=E2=80=94=20quoted=20literal=20constant=20mutation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root cause: normalize-box and slot :initforms used quoted literal lists ('(...)) that were destructively modified by (setf (getf ...)). Each call to normalize-box with a non-nil spec corrupted the shared default list, causing all subsequent nodes with no explicit padding to inherit the previous node's padding values. Fix: replace all '(...) quoted literals with (list ...) constructor calls — in normalize-box (3 paths) and in slot initforms for both padding and margin. All 11 test suites now pass: 358/358 checks, 0 failures. --- cl-tty.asd | 12 ++++++------ layout/layout.lisp | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cl-tty.asd b/cl-tty.asd index e4c5184..3ea8b13 100644 --- a/cl-tty.asd +++ b/cl-tty.asd @@ -68,12 +68,12 @@ (:file "render-tests") (:file "theme-tests") (:file "input-tests") - (:file "scrollbox-tabbar-tests" :pathname "../../tests/scrollbox-tabbar-tests.lisp") - (:file "select-tests" :pathname "../../tests/select-tests.lisp") - (:file "markdown-tests" :pathname "../../tests/markdown-tests.lisp") - (:file "dialog-tests" :pathname "../../tests/dialog-tests.lisp") - (:file "mouse-tests" :pathname "../../tests/mouse-tests.lisp") - (:file "slot-tests" :pathname "../../tests/slot-tests.lisp")))) + (:file "scrollbox-tabbar-tests" :pathname "../../tests/scrollbox-tabbar-tests") + (:file "select-tests" :pathname "../../tests/select-tests") + (:file "markdown-tests" :pathname "../../tests/markdown-tests") + (:file "dialog-tests" :pathname "../../tests/dialog-tests") + (:file "mouse-tests" :pathname "../../tests/mouse-tests") + (:file "slot-tests" :pathname "../../tests/slot-tests")))) :perform (test-op (o c) (let ((run (find-symbol "RUN" :fiveam)) (explain (find-symbol "EXPLAIN!" :fiveam))) diff --git a/layout/layout.lisp b/layout/layout.lisp index 2c03cef..d71f569 100644 --- a/layout/layout.lisp +++ b/layout/layout.lisp @@ -19,9 +19,9 @@ (in-package :cl-tty.layout) (defun normalize-box (spec) - (cond ((null spec) '(:top 0 :right 0 :bottom 0 :left 0)) - ((numberp spec) `(:top ,spec :right ,spec :bottom ,spec :left ,spec)) - (t (loop with result = '(:top 0 :right 0 :bottom 0 :left 0) + (cond ((null spec) (list :top 0 :right 0 :bottom 0 :left 0)) + ((numberp spec) (list :top spec :right spec :bottom spec :left spec)) + (t (loop with result = (list :top 0 :right 0 :bottom 0 :left 0) for (key val) on spec by #'cddr do (setf (getf result key) val) finally (return result))))) @@ -39,8 +39,8 @@ (direction :initform :column :initarg :direction :accessor layout-node-direction) (grow :initform 0 :initarg :grow :accessor layout-node-grow) (shrink :initform 1 :initarg :shrink :accessor layout-node-shrink) - (padding :initform '(:top 0 :right 0 :bottom 0 :left 0) :initarg :padding :accessor layout-node-padding) - (margin :initform '(:top 0 :right 0 :bottom 0 :left 0) :initarg :margin :accessor layout-node-margin) + (padding :initform (list :top 0 :right 0 :bottom 0 :left 0) :initarg :padding :accessor layout-node-padding) + (margin :initform (list :top 0 :right 0 :bottom 0 :left 0) :initarg :margin :accessor layout-node-margin) (gap :initform 0 :initarg :gap :accessor layout-node-gap) (position-type :initform :relative :initarg :position-type :accessor layout-node-position-type) (position-offset :initform nil :initarg :position-offset :accessor layout-node-position-offset)