Stick-to-bottom scroll regions and scroll-to-bottom! main
A #:scroll-y container can declare #:stick-bottom #t to follow its bottom edge while content grows (chat logs). The decision happens in ensure_scrolls, before the new layout, so the handle still holds last frame's offsets: a container within ~4px of its bottom — or never laid out, when both offset and max are zero — is re-pinned via gpui's scroll_to_bottom flag, which the element consumes in its next prepaint, after this render's layout, where the new bottom is known. A reader who scrolled up fails the check and stays put until they return to the bottom. The new scroll-to-bottom! builtin (jump-to-latest buttons, snapping a log down after a route change) rides the widget command queue as a one-shot Command::ScrollToBottom; its drain interns the handle rather than looking it up — handles are just shared offsets, no Window needed — so a command aimed at a container that first appears on the very next render still lands. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>