fix: nested grow() children overflow parent padding on grow()-sized padded roots - #115
Draft
natemoo-re wants to merge 3 commits into
Draft
fix: nested grow() children overflow parent padding on grow()-sized padded roots#115natemoo-re wants to merge 3 commits into
natemoo-re wants to merge 3 commits into
Conversation
commit: |
natemoo-re
added a commit
that referenced
this pull request
Aug 27, 2026
Clay's debug inspector (Clay__RenderDebugView, ~700 lines + ~150 UI strings) is reachable from the exported Clay_EndLayout behind runtime debugModeEnabled branches, so --gc-sections can't drop it; at -O2 clang inlines it into the layout monolith. clayterm never enables debug mode, so it's dead weight. Adds an upstream-compatible CLAY_DISABLE_DEBUG_TOOLS guard (patches/clay-disable-debug-tools.patch), generated against the submodule's recorded commit (938967a) and covering all four debugModeEnabled sites, opted in via -DCLAY_DISABLE_DEBUG_TOOLS. The Makefile now applies Clay patches generically: every patches/*.patch is applied (in sorted order) after resetting clay/clay.h to pristine, so the applied set always matches the directory exactly and future patches (e.g. #115's grow-minDimensions fix) need no per-patch Makefile wiring. Reverted by make clean. Drop individual patches as they ship upstream. raw wasm 155,877 -> 101,208 (-35.1%); brotli 44,141 -> 29,133. Cold path only (debugModeEnabled always false at runtime); deno task test test/ passes (19 files, 227 steps).
natemoo-re
force-pushed
the
fix/nested-grow-right-padding
branch
from
August 27, 2026 10:06
e7a31bd to
e40a12e
Compare
|
Size Reduced — -19.0 KB 99.9 KB unpacked |
Clay's debug inspector (Clay__RenderDebugView, ~700 lines + ~150 UI strings) is reachable from the exported Clay_EndLayout behind runtime debugModeEnabled branches, so --gc-sections can't drop it; at -O2 clang inlines it into the layout monolith. clayterm never enables debug mode, so it's dead weight. Adds an upstream-compatible CLAY_DEBUG_MODE_ENABLED value macro (default 1; patches/clay-debug-mode-enabled.patch), named to match the runtime context->debugModeEnabled selector. Generated against the submodule's recorded commit (938967a) and covering all four debugModeEnabled sites; opted out via -DCLAY_DEBUG_MODE_ENABLED=0. The Makefile now applies Clay patches generically: every patches/*.patch is applied (in sorted order) after resetting clay/clay.h to pristine, so the applied set always matches the directory exactly and future patches (e.g. #115's grow-minDimensions fix) need no per-patch Makefile wiring. Reverted by make clean. Drop individual patches as they ship upstream. raw wasm 155,877 -> 101,208 (-35.1%); brotli 44,141 -> 29,133. Cold path only (debugModeEnabled always false at runtime); deno task test test/ passes (19 files, 227 steps).
natemoo-re
force-pushed
the
ref/clay-debug-tools
branch
from
August 27, 2026 10:08
fe0f62d to
0a1e0a8
Compare
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. Shipped as patches/clay-grow-minDimensions.patch, picked up by the Makefile's generic patches/*.patch apply step (from ref/clay-debug-tools) — no build wiring in this commit. Generated against the submodule's recorded commit (938967a); reverted by make clean. Long-term destination is upstream nicbarker/clay. 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).
natemoo-re
force-pushed
the
fix/nested-grow-right-padding
branch
from
August 27, 2026 10:08
e40a12e to
96d248c
Compare
natemoo-re
added a commit
that referenced
this pull request
Aug 27, 2026
Clay's debug inspector (Clay__RenderDebugView, ~700 lines + ~150 UI strings) is reachable from the exported Clay_EndLayout behind runtime debugModeEnabled branches, so --gc-sections can't drop it; at -O2 clang inlines it into the layout monolith. clayterm never enables debug mode, so it's dead weight. Adds an upstream-compatible CLAY_DEBUG_MODE_ENABLED value macro (default 1; patches/clay-debug-mode-enabled.patch), named to match the runtime context->debugModeEnabled selector. Generated against the submodule's recorded commit (938967a) and covering all four debugModeEnabled sites; opted out via -DCLAY_DEBUG_MODE_ENABLED=0. The Makefile now applies Clay patches generically: every patches/*.patch is applied (in sorted order) after resetting clay/clay.h to pristine, so the applied set always matches the directory exactly and future patches (e.g. #115's grow-minDimensions fix) need no per-patch Makefile wiring. Reverted by make clean. Drop individual patches as they ship upstream. raw wasm 155,877 -> 101,208 (-35.1%); brotli 44,141 -> 29,133. Cold path only (debugModeEnabled always false at runtime); deno task test test/ passes (19 files, 227 steps).
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 correctlyClay__CloseElementsetminDimensionsfrom content-derived size forGROWelements; for agrow()root with padding,minDimensions.width = text_width + paddingexceeded terminal width, soSizeContainersAlongAxisrefused to compress the root below that minimumGROWelements' minimum compressible size is now the user-configuredmin(default0), not natural content size; non-GROWtypes unchanged; both width and height axes coveredpatches/clay-grow-minDimensions.patch, picked up automatically by ref(opt): compile out Clay's unused debug-tools UI #89's genericpatches/*.patchapply step — this PR adds no build wiring; patch verified against the submodule's recorded commit (938967a); reverted bymake clean; long-term destination is upstream nicbarker/clayref/clay-debug-tools); retarget tomainafter it merges — CodSpeed won't auto-run until then (benchmark.yml only runs on PRs to main)specs/renderer-spec.md§8.4 now states thatgrow()min is the configured min, not content sizefixed()vsgrow()root identical positions, asymmetric padding, two-level nesting, height-axisbounds.heightcheck