# Improve handling of large output in embedded terminals \(\#32416\) · gitcafe/zed

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

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

Visibility: public

Requested revision: b103d7621b0ec48d5134d3c7c7f174a214e80c51

Requested commit: b103d7621b0ec48d5134d3c7c7f174a214e80c51

Commit: b103d7621b0ec48d5134d3c7c7f174a214e80c51

Tree: 4b03b51a8f1965501b94ba467610b15e158b26f6

Author: Agus Zubiaga

Committer: GitHub

## Message

```
Improve handling of large output in embedded terminals (#32416)

#31922 made embedded terminals automatically grow to fit the content. We
since found some issues with large output which this PR addresses by:

- Only shaping / laying out lines that are visible in the viewport
(based on `window.content_mask`)
- Falling back to embedded scrolling after 1K lines. The perf fix above
actually makes it possible to handle a lot of lines, but:
- Alacrity uses a `u16` for rows internally, so we needed a limit to
prevent overflow.
- Scrolling through thousands of lines to get to the other side of a
terminal tool call isn't great UX, so we might as well set the limit
low.
- We can consider raising the limit when we make card headers sticky.

Release Notes:

- Agent: Improve handling of large terminal output
```

## Parents

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

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