# agent_panel: Fix mention pasting crash \(\#58375\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 7a8f13902982b087e6e27e4d105e9595b26b9429

Requested commit: 7a8f13902982b087e6e27e4d105e9595b26b9429

Commit: 7a8f13902982b087e6e27e4d105e9595b26b9429

Tree: 7937750c7093280a0b0f12ecf7abffdba74e3229

Author: Anthony Eid

Committer: GitHub

## Message

```
agent_panel: Fix mention pasting crash  (#58375)

This crash occurred because metion crease were using raw text ranges
that were precomputed before calling editor.edit(), and didn't take into
account that editor normalizes text inserted

The fix is normalizing the text first, then using the normalize text
range for the crease

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

Release Notes:

- Fix a crash that could occur when adding a crease to the agent panel
```

## Parents

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

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