fix: nested grow() children overflow parent padding on grow()-sized padded roots - #115
Draft
natemoo-re wants to merge 2 commits into
Draft
fix: nested grow() children overflow parent padding on grow()-sized padded roots#115natemoo-re wants to merge 2 commits into
natemoo-re wants to merge 2 commits into
Conversation
Clay's CloseElement set minDimensions from content-derived size for all element types, including GROW. For a GROW root with right padding, the content-derived minDimensions.width was text_width + padding, which exceeded the terminal width. SizeContainersAlongAxis then refused to compress the root below that minimum, so the root overflowed the terminal and nested grow() spacers were clipped past the parent's right (and bottom) padding. The fix: GROW elements resolve against the parent content box, so their minimum compressible size is the user-configured min (default 0), not the natural size of their content. Non-GROW types are unchanged. Applied via patches/clay-grow-minDimensions.patch at build time, following the same pattern as patches/clay-disable-debug-tools.patch from ref/clay-debug-tools. The Makefile applies the patch idempotently before compilation and restores clay/clay.h on `make clean`. specs/renderer-spec.md §8.4 updated to document the content-box semantics: grow() minimum is the configured min, not content size.
Four cases covering the fixed behavior:
(a) fixed() and grow() roots produce identical child positions for a
right-aligned row (text + grow spacer + text) with symmetric padding.
(b) grow() root with asymmetric padding — R lands at the correct column
respecting the larger right pad, not overflowing it.
(c) Two levels of grow() nesting — each box preserves its own content
box so R remains inside the innermost right padding.
(d) Height axis — grow() root bounds.height equals terminal height even
when content rows + vertical padding exceed it (catches the same
minDimensions bug on the Y axis).
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
grow()children under a paddedgrow()-sized parent overflowed or were clipped past the parent's right and bottom padding; an identical tree under afixed()-sized parent laid out correctlyroot cause:
Clay__CloseElementsetminDimensionsfrom content-derived size forGROWelements; for agrow()root with padding,minDimensions.width = text_width + paddingexceeded terminal width, soSizeContainersAlongAxisrefused to compress the root below that minimumfix:
GROWelements' minimum compressible size is now the user-configuredmin(default0), not natural content size; non-GROWtypes unchanged; both width and height axes coveredapplied as
patches/clay-grow-minDimensions.patchat build time, same pattern aspatches/clay-disable-debug-tools.patch; idempotent, reverted bymake clean; long-term destination is upstream nicbarker/clayspecs/renderer-spec.md§8.4 now states thatgrow()min is the configured min, not content size4 regression tests:
fixed()vsgrow()root identical positions, asymmetric padding, two-level nesting, height-axisbounds.heightcheck