fix: measure full stack leaf width
Measure every rendered line when a column determines its natural width so a narrower first Grid line cannot cause later lines to overflow after stack padding.\n\nVerified with make check; core 545/545 and Grid 11/11 passed.
This commit is contained in:
parent
8a8e862098
commit
de6f56637b
@ -2774,7 +2774,8 @@ stack itself uses its natural max child width."
|
|||||||
(let* ((rendered-items
|
(let* ((rendered-items
|
||||||
(mapcar (lambda (leaf)
|
(mapcar (lambda (leaf)
|
||||||
(let ((rendered (ebox--render-with-cache leaf)))
|
(let ((rendered (ebox--render-with-cache leaf)))
|
||||||
(cons rendered (ebox--string-pixel-width rendered))))
|
(cons rendered
|
||||||
|
(ebox--string-max-pixel-width rendered))))
|
||||||
(ebox--stack-leaves node)))
|
(ebox--stack-leaves node)))
|
||||||
(max-w (apply #'max (mapcar #'cdr rendered-items)))
|
(max-w (apply #'max (mapcar #'cdr rendered-items)))
|
||||||
(target-w (if ebox--intrinsic-layout-measurement
|
(target-w (if ebox--intrinsic-layout-measurement
|
||||||
|
|||||||
@ -37,6 +37,22 @@
|
|||||||
(should (= (length lines) 1))
|
(should (= (length lines) 1))
|
||||||
(should (= (ebox--string-pixel-width (car lines)) 120))))
|
(should (= (ebox--string-pixel-width (car lines)) 120))))
|
||||||
|
|
||||||
|
(ert-deftest ebox-grid-keeps-padded-items-inside-column-width ()
|
||||||
|
"Stack padding should use the widest Grid line instead of its first line."
|
||||||
|
(let* ((header (ebox-create :content "Header" :width '(720)))
|
||||||
|
(grid (ebox-grid
|
||||||
|
:width '(718)
|
||||||
|
:grid-template-columns '((220) 1fr)
|
||||||
|
:gap '(1 (12))
|
||||||
|
:border "#C97252"
|
||||||
|
(ebox-create :content "Fixed" :width '(196)
|
||||||
|
:padding '(1 (12)))
|
||||||
|
(ebox-create :content "Fractional" :width '(460)
|
||||||
|
:padding '(1 (12)))))
|
||||||
|
(lines (ebox-string-lines (ebox-render (ebox-column header grid))))
|
||||||
|
(widths (mapcar #'ebox--string-pixel-width lines)))
|
||||||
|
(should (= (apply #'max widths) 720))))
|
||||||
|
|
||||||
(ert-deftest ebox-grid-supports-explicit-placement-and-span ()
|
(ert-deftest ebox-grid-supports-explicit-placement-and-span ()
|
||||||
"Explicit placement should support a cell spanning two columns."
|
"Explicit placement should support a cell spanning two columns."
|
||||||
(let ((plain
|
(let ((plain
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user