Skip to content

Slide an arriving line into sight in a scrolled thread view, and tint the working line - #6338

Merged
leaf-agent merged 5 commits into
mainfrom
arriving-content-slides-in
Nov 18, 2026
Merged

leaf-agent merged 5 commits into
mainfrom
arriving-content-slides-in

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

When the agent's answer or working line arrives in a thread view that scrolls (the floating panel's view of a long thread, a margin card's capped transcript) and the reader stood at its end, the view jumped to its new end in one frame, moving every turn above up at once. It now glides there with Leaf's 140 ms glide, so the turns slide up as the line comes into sight. The working line (.lf-thread-working) also wears the yellow arrival tint a new message wears; arrivalTint in thread/messages.js is the one home for it. Measured frame by frame in the panel's view, in Chromium and Firefox: 77 px in one frame before, about 150 ms of travel after.

A glide headed to a box's end now counts as standing there for everything that keeps a box at its end. scrollToEnd leaves such a glide alone, or turns it toward the end's new place, instead of jumping: in a margin card, the landing of the user's own send moves the transcript to its end at every refit, which cut the answer's glide to a jump. The card's end keeper (followEnd) and #fitAnswer read where the box is headed, so growth that arrives during the glide, such as a picture loading, is still followed, and the user's turn is placed above New reply from where the glide lands. Checked with the glide slowed to 4 s: before, the card jumped on the answer after a send and the panel's placement of the turn depended on frame timing; after, both glide and come to rest where the instant version did.

Not covered: a thread view that grows to hold the line (a short thread's panel view, a margin card below its cap) still moves its contents in one frame. box-motion.js shows news where it stands, and the shift watch credits travel only to input; changing that is a separate decision.

Requested by Max. Tests: selected floating panel, margin card, card opening, sending, go-to, bounded log and agent reply cases; pnpm run test:runtime, with a new case holding scrollToEnd to leave or turn a glide to the end (it fails on the old rule); pnpm run check:browser.

This was written by Claude Code on behalf of max-sixty

…working message's arrival

When the agent's answer to the user's turn arrived in a thread view at its
height cap, as in the floating panel's view of a long thread, the view
jumped to its end in one frame, so every turn above moved up at once. It
now glides there (`scrollToEnd(…, "smooth")` in `#fitAnswer`, Leaf's
140 ms glide), so the turns slide up as the answer comes into sight. The
user asked for arrivals to slide rather than jump. Measured per frame in
the panel's view with the work's first step arriving: the turns moved
77 px in one frame before, and now travel over about 140 ms in both
Chromium and Firefox. Reduced motion still jumps, as every glide does.

The working message's face (the dim line showing the agent's current
step) now wears the arrival tint a message wears, the yellow ground that
fades over `--lf-motion-flash`. It previously appeared untinted, while
the answer replacing it was tinted. `arrivalTint` in messages.js is the
one home for that tint; a new step in a face already drawn plays none.

Not covered: news that grows a floating box rather than scrolling it, as
a short thread's panel view or a margin card grows to hold an answer,
still moves the box's contents in one frame. box-motion.js shows news
where it stands while only the outline glides, and the shift watch
credits travel only to an input, so carrying news needs the watch to
judge a news carry by the layout move it draws.

Checks: selected floating panel, margin card, agent reply, shift watch,
read state and page-holds-still cases (139 passed, 6 xfailed as before),
`pnpm run test:runtime`, `pnpm run check:browser`.
… view's end

An answer that grows again while the view still glides to its end, as a
streaming reply's next words can within the glide's 140 ms, read the box
mid-glide as short of its end and put New reply up in place of following
it. `#fitAnswer` now reads where the box is headed (`scrollGoal`), as
the end keepers do.
leaf-agent
leaf-agent previously approved these changes Nov 18, 2026
… reply's turn from where it lands

An independent review of #6338 found the new 140 ms glide could leave a thread view in the wrong place when more arrived before it landed; probing that with the glide slowed to 4 s found a third case, in the margin card:

- After the user's own send, a margin card's landing moves its transcript to its end at every refit (reply-landing.js, `keepThreadLanding`), and an instant `scrollToEnd` stopped any glide: the answer's glide was cut to a jump in the first frame, so the card never slid. `scrollToEnd` now leaves a glide already headed to the end alone, and turns one whose end has moved toward the new end. A glide records whether its goal was the end (`end`).
- The card's end keeper (`followEnd`) counted the reader at the end only once the box's offset reached it, so growth the thread doesn't re-render, such as a picture loading during the glide, left the reader short of the new end with no New reply. The keeper now reads where the box is headed; a glide headed away from the end, as `u` starts, still reads as leaving it.
- When an answer outgrew the panel's view mid-glide, `#fitAnswer` measured the user's turn against New reply mid-way, and either skipped the placement or moved the box from where it stood and stopped the glide, so the view came to rest at 91 px or 148 px depending on frame timing (148 px is where the instant version rests). It now measures from where the box is headed and glides there; with no glide under way, the placement glides rather than jumps.

The tint comments now name what the code tints: a progress run's face.

Checked with SCROLL_MS at 4000 in `leaf-dev probe` journeys (panel at cap: working line then a long answer 0.2 s later; margin card: answer after a send, picture growth 2.5 s in): the card now glides from the answer's arrival and rests at its end; the panel rests at 148 px in every run.
A runtime case: a move to a box's end leaves a glide already headed there going, turns it toward the end's new place when the box grows, and is instant with no glide under way. It protects the margin card's glide after the user's own send, which the card's send landing cut to a jump at every refit. With the previous rule restored, the case fails at "a move to the end cut the glide to a jump".
@leaf-agent
leaf-agent merged commit 63252fe into main Nov 18, 2026
5 checks passed
@leaf-agent
leaf-agent deleted the arriving-content-slides-in branch November 18, 2026 03:02
max-sixty added a commit that referenced this pull request Nov 18, 2026
…in the shift watch (#6382)

In a thread view that grows to hold an arriving line (the floating
panel's view of a short thread, a margin card below its cap), the turns
above the line jumped up in one frame while only the view's outline
travelled. `box-motion.js` now carries news as it already carried the
user's own send: each part news moved is drawn where it was and travels
to where it stands, over about 200 ms. Measured frame by frame after
each paint in Firefox: 77 px in one frame before, travel after; Chromium
the same. This follows #6338, which made a view that scrolls glide to
its end.

Most of the diff is `tests/shift_watch.js`, which credited a translation
only to an input that began it, so the carry failed panel tests as
"moved without input". Its new "Carries of a step" reads as a carry a
translation no rendering owns, begun while no input's rendering is open,
that ends with its target where its layout puts it. It credits that
translation only while each node stays between its pose before the step
and its layout net of the carry, and judges the step itself as if drawn
at once. An independent review found four ways the first version let
real motion through: a step the carry hid lost to a key press, the bound
lost once readings were retired, a new line riding any translation, and
a height tween recursing. All four are fixed, and each has a case in
`test_render_shift_watch.py` that fails on that version. The carry
reverses `box-motion.js`'s earlier rule that news shows each part where
it now stands.

Requested by Max, who chose carrying news in growing views over keeping
the jump. Tests: `test_render_shift_watch.py`, the floating panel, send
placement, margin card, composing, reactions, aim, sending, go-to,
bounded log and chrome contract files, and journeys
`test_page_holds_still.py`, `test_thread_response_continuity.py` and
`test_floating_box_motion.py`, passing but for
`test_an_open_view_covers_the_page_beneath_it` (#5744) and
`test_a_drawing_names_its_proxies_and_keeps_its_place_among_the_page`,
which fails without this change too; two cases,
`test_a_line_the_field_gives_up_rides_the_box_s_top_edge` and one arm of
`test_send_grows_thread_around_the_words`, each failed once under the
heaviest load and pass alone; `pnpm run test:runtime`; `pnpm run
check:browser`.

> _This was written by Claude Code on behalf of max-sixty_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants