Skip to content

gpui: Refactor follow_tail implementation to fix scroll snapping bugs#53101

Merged
mikayla-maki merged 1 commit intomainfrom
list-follow-tail-fix
Apr 3, 2026
Merged

gpui: Refactor follow_tail implementation to fix scroll snapping bugs#53101
mikayla-maki merged 1 commit intomainfrom
list-follow-tail-fix

Conversation

@danilo-leal
Copy link
Copy Markdown
Member

@danilo-leal danilo-leal commented Apr 3, 2026

Follow up to #53017

This PR does some significant refactoring to the follow_tail feature in the GPUI list. That's only used by the agent panel's thread view and given the height-changing nature of streaming agent responses, we were seeing some scroll snapping bugs upon scrolling while the thread is generating. In the process of fixing it, we introduced a remeasure_items method as an alternative to splice so that we could get the remeasurement fix without scroll position changes. We already had a remeasure method that did that for all of the indexes, but we needed something more scoped out for the agent panel case, so as to not remeasure the entire list's content on every new streamed token.

Effectively, this ends up reverting what the PR linked above introduced, but it improved the API in the process.

Release Notes:

  • N/A

thread view

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
@danilo-leal danilo-leal requested a review from mikayla-maki April 3, 2026 21:09
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Apr 3, 2026
@zed-community-bot zed-community-bot bot added the staff Pull requests authored by a current member of Zed staff label Apr 3, 2026
@mikayla-maki mikayla-maki enabled auto-merge (squash) April 3, 2026 21:14
@mikayla-maki mikayla-maki merged commit 2fbf830 into main Apr 3, 2026
41 checks passed
@mikayla-maki mikayla-maki deleted the list-follow-tail-fix branch April 3, 2026 21:27
rtfeldman pushed a commit that referenced this pull request Apr 4, 2026
…#53101)

Follow up to #53017

This PR does some significant refactoring of the `follow_tail` feature
in the GPUI list. That's only used by the agent panel's thread view and
given to the height-changing nature of streaming agent responses, we
were seeing some scroll snapping bugs upon scrolling while the thread is
generating. In the process of fixing it, we introduced a
`remeasure_items` method as an alternative to `splice` so that we could
get the remeasurement fix without scroll position changes. We already
had a `remeasure` method that did that for all of the indexes, but we
needed something more scoped out for the agent panel case, so as to not
remeasure the entire list's content on every new streamed token.

Effectively, this ends up reverting what the PR linked above introduced,
but it improved the API in the process.
 
Release Notes:

- N/A

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
osyvokon added a commit that referenced this pull request Apr 6, 2026
Refactoring in #53101 broke manual scrolling in many ways. This change
restores it, accounting for the new FollowMode enum.
danilo-leal added a commit that referenced this pull request Apr 6, 2026
Follow-up to #53101

In the process of fixing the thread view's scroll experience, we for got
to turn off the follow state tail for functions that power the scroll
buttons in the agent panel.

Release Notes:

- N/A
MasoudAlali pushed a commit to MasoudAlali/zed-ide that referenced this pull request Apr 7, 2026
Follow-up to zed-industries#53101

In the process of fixing the thread view's scroll experience, we for got
to turn off the follow state tail for functions that power the scroll
buttons in the agent panel.

Release Notes:

- N/A
KlausUllrich added a commit to KlausUllrich/zed that referenced this pull request Apr 8, 2026
…tion

Port upstream follow_tail refactor (Zed PRs zed-industries#53101, zed-industries#53232) as fresh
feature addition:

- Add FollowMode (pub) + FollowState (internal) enums
- Migrate ListItem::Unmeasured estimated_height → size_hint: Option<Size<Pixels>>
- Add remeasure_items(range) — scoped remeasure preserving size hints
- Add set_follow_mode(), is_following_tail(), scroll_to_end()
- Add follow_state logic to scroll/scroll_by/scroll_to/set_offset_from_scrollbar
- Add auto-scroll + re-engagement in layout_items()
- Add is_following_tail field to ListScrollEvent

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants