# gpui: Fix material list unstable scrollbar position \(\#55808\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/dfd8328f7b87a959c46d51bf964a58158a5019ab)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: dfd8328f7b87a959c46d51bf964a58158a5019ab

Requested commit: dfd8328f7b87a959c46d51bf964a58158a5019ab

Commit: dfd8328f7b87a959c46d51bf964a58158a5019ab

Tree: 4e005bc67b91b7256d0455f9ae9fc68516b10afa

Author: Anthony Eid

Committer: GitHub

## Message

```
gpui: Fix material list unstable scrollbar position (#55808)

Before this PR, `ListState` always used a proportional pending scroll
fraction to preserve the relative scroll position when list items were
resized. This caused text to creep in the agent panel when the scrollbar
was in the middle of the list while the agent was generating text,
because streaming updates changed the logical scroll top slightly.

This PR fixes that behavior by using an absolute offset when only a
subset of items is remeasured, added, or deleted, keeping the logical
top position stable.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #ISSUE

Release Notes:

- N/A

---------

Co-authored-by: Remco Smits <djsmits12@gmail.com>
```

## Parents

- [a4005b6d99aaa96458ec7cafd786e6e747a56b5a](https://git.cafe/gitcafe/zed/commit/a4005b6d99aaa96458ec7cafd786e6e747a56b5a?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/dfd8328f7b87a959c46d51bf964a58158a5019ab?format=markdown)
