# agent_ui: Serialize copied selection mentions as links \(\#54031\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 4733ae4de36d1579df42276ede10eaef74d50df1

Requested commit: 4733ae4de36d1579df42276ede10eaef74d50df1

Commit: 4733ae4de36d1579df42276ede10eaef74d50df1

Tree: 16c5a911c6bf348c9fa3a1c25521724a804aaf97

Author: Hamza Paracha

Committer: GitHub

## Message

```
agent_ui: Serialize copied selection mentions as links (#54031)

Fixes #53981

Selection mentions inserted from the agent panel are stored as folded
placeholder text in the message editor. That meant a normal copy would
put the literal `selection` token on the clipboard, and pasting into a
new thread would lose the original mention context.

This teaches `MessageEditor` to serialize selected folded mentions as
their mention links before writing to the clipboard. The surrounding
text stays intact, and the existing paste path can rebuild the mentions
in a fresh thread.

Release Notes:

- Fixed copied agent prompts replacing selection mentions with the
literal word `selection`.

---------

Co-authored-by: Neel <neel@zed.dev>
```

## Parents

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

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