# agent_ui: Fix expanded message editor jitters while typing \(\#52612\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 7f7520b98ed1a0ce03dab1d5ddcb87163f1bcdb8

Requested commit: 7f7520b98ed1a0ce03dab1d5ddcb87163f1bcdb8

Commit: 7f7520b98ed1a0ce03dab1d5ddcb87163f1bcdb8

Tree: 34cea0b224aa0eff451d551aef55b14c100f93be

Author: Yao Xiao

Committer: GitHub

## Message

```
agent_ui: Fix expanded message editor jitters while typing (#52612)

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 #52132.

*This PR previously also fixes the "expanded message editor not taking
up full height" part, but #52545 has already fixed that. Yet it seems to
leave a new issue (that was previously not revealed) behind, as
follows.*

This PR fixes the `Full + ExcludeOverscrollMargin` editor mode (which
the agent panel message editor uses in expanded mode), which could
jitter while typing because render-time layout and scroll-position
updates were clamping against different effective
`scroll_beyond_last_line` policies. This PR fixes that inconsistency so
the expanded editor stays stable while typing, and adds a regression
test covering `ExcludeOverscrollMargin` scroll clamping.


https://github.com/user-attachments/assets/86abf04d-c1a1-419b-96d0-8ca097c0acb0


https://github.com/user-attachments/assets/03dbdc3c-f58e-4378-8c6a-4bda1ae425c8

Release Notes:

- Fixed the expanded Agent Panel message editor so it no longer jitters
while typing.

---------

Co-authored-by: MrSubidubi <finn@zed.dev>
```

## Parents

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

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