agent_ui: Make thread generation top-down#52440
Conversation
Co-Authored-By: Richard Feldman <oss@rtfeldman.com>
Co-Authored-By: Richard Feldman <oss@rtfeldman.com>
…or errored Co-Authored-By: Richard Feldman <oss@rtfeldman.com>
Co-Authored-By: Richard Feldman <oss@rtfeldman.com>
This comment was marked as off-topic.
This comment was marked as off-topic.
| content_height - self.scrollbar_drag_start_height.unwrap_or(content_height); | ||
| let new_scroll_top = (point.y - drag_offset).abs().max(px(0.)).min(scroll_max); | ||
|
|
||
| self.follow_tail = false; |
There was a problem hiding this comment.
@danilo-leal I found a couple of edge cases this was missing and I just pushed fixes instead of suggestions 😄
This one was for the case where you're dragging the scroll bar around instead of using a ScrollWheel event; I assume we want to disengage follow_tail there too!
rtfeldman
left a comment
There was a problem hiding this comment.
Excited to use this! 😃
This PR fixes an issue where, sometimes, you couldn't scroll all the way to the bottom of the thread's content. The scrollbar would show up at the bottom of the scrollable container but the content was visibly cut off. Turns out that's a consequence of the top-down thread generation introduced in #52440, where changing the list alignment to `Top` made it visible that sometimes, the maximum scroll area would get underestimated because the items in the thread view's list would have a stale height measurement. So, the way this PR fixes the issue is by calling `splice_focusable` in the `EntryUpdated` event, too, so that the height of the items in the overdraw area get marked as unmeasured, triggering a list re-render and re-measuring. We started by writing a test at the list level that would reproduce the regression but then later figured out that this is not an inherent list problem; it was rather a problem with its use within the thread view layer. Then, we explored writing a test that documented the regression, but it turned out to be very hard to simulate this sort of set up in which certain elements would have its height changed during streaming, which would be how you'd get to a mismatched height situation. Therefore, given `AcpThreadEvent::NewEntry` already called `splice_focusable` and don't have a test for it, we figure it'd be safe to move forward without one, too. We then introduced a helper that's now shared between `AcpThreadEvent::NewEntry` and `AcpThreadEvent::EntryUpdated`. Release Notes: - Agent: Fixed an issue where sometimes you couldn't scroll all the way to the bottom of the thread even though there's visibly more content below the fold. Co-authored-by: Eric Holk <eric@zed.dev>
|
That’s a nice feature - how can I turn it off again? Why can’t you switch it on or off via a setting? I find it very fiddly to have to look right at the top of a 32-inch monitor for the AI output after I’ve typed something at the bottom. Such fundamental changes to the GUI should always have an on/off switch. I’ve been using Zed since the very beginning, and here and there you’re being a bit too intrusive when it comes to the user interface. Just when you’ve got used to it, you change it again. This feature is yet another jarring break in the GUI. So please, give us an on/off switch. I’d like the output to be placed back where it was, and not 2700 pixels above the input. Thanks. Update One more minor bug: the scrolling in the new version always eats up the last line when you finally reach the bottom (macOS Version). |
|
Yeah this is a pretty awful change for anyone who considers this the sort of thing you fight against in bad implementations of a scrolling stream. (sigh) |
Ever since we introduced the agent panel the way it is right now back in May 2025, we wanted to make the thread generation be top-down. Now, with the changes we're planning to launch very soon revolving around parallel agents, doing this become even more important for a better experience. Particularly because in the agent panel's new empty state, the message editor is full screen. We want to minimize as much as possible layout shift between writing your first prompt and actually submitting it. So this means that content will stream down from your first prompt and auto-scroll you if it goes beyond the viewport.
To pull this off, we added a
follow_tailfeature directly to the GPUI list so that we could only call it in the thread view layer as opposed to doing it all there.Screenshot.2026-03-25.at.3.47.mp4
Release Notes: