# acp_thread: Add authoritative terminal display updates \(\#64976\) · gitcafe/zed

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

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

Visibility: public

Requested revision: f2cdf3d5bd87c4240a634eafa05c51fcf9827ede

Requested commit: f2cdf3d5bd87c4240a634eafa05c51fcf9827ede

Commit: f2cdf3d5bd87c4240a634eafa05c51fcf9827ede

Tree: edb340a7175520c5cc628d460706fe716bec2965

Author: Ben Brandt

Committer: GitHub

## Message

```
acp_thread: Add authoritative terminal display updates (#64976)

Add a shared, byte-oriented terminal display update boundary without
enabling v2 transport. References, output-first updates, and snapshots
reuse the existing terminal registry and the same model, renderer, and
read-only view.

- Add tri-state terminal patches for command, cwd, decoded output
snapshots, exit information, and metadata. Keep terminal, snapshot,
exit, and content-reference metadata in their own scopes; consume
appended bytes without another raw-output history store.
- Create display placeholders for unseen v2 tool-content terminal
references. Existing v1 missing references remain errors.
Native/client-owned terminals, including no-PTY wrappers, reject display
patches.
- Keep append separate from replacement. Replacement rebuilds the
emulator/parser at the latest requested bounds, preserves configuration
and entity/view identity, and invalidates selection, search, hover,
scrolling, and cursor blinking.
- Stamp parser events with the output generation so queued old titles
cannot resurface. Drop all obsolete internal events, including
historical resizes, rather than applying them to the new screen.
- Preserve legacy first-Created/first-Exit behavior through independent
event markers. Late creation fills a placeholder without replacing its
renderer; pending legacy bytes drain before later snapshots. Reported
command values and explicit clears outrank caption fallbacks.

## Review guide

1. [Shared model and decoded patch
types](https://github.com/zed-industries/zed/blob/99eb1f22a5f3210d00b4253582c589b60d4a0cb2/crates/acp_thread/src/terminal.rs#L427),
then [registry/upsert entry
points](https://github.com/zed-industries/zed/blob/99eb1f22a5f3210d00b4253582c589b60d4a0cb2/crates/acp_thread/src/acp_thread.rs#L6768):
identity, metadata, output/exit independence, and legacy compatibility.
2. [Renderer
replacement](https://github.com/zed-industries/zed/blob/99eb1f22a5f3210d00b4253582c589b60d4a0cb2/crates/terminal/src/terminal.rs#L2007):
configuration/bounds, parser reset, process isolation, and stale-event
invalidation.
3. [View
invalidation](https://github.com/zed-industries/zed/blob/99eb1f22a5f3210d00b4253582c589b60d4a0cb2/crates/terminal_view/src/terminal_view.rs#L1211)
and the rendered tool-card regression: the existing read-only view
survives replacement and completion changes.

Release Notes:

- N/A
```

## Parents

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

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