Skip to content

agent_panel: Fix mention pasting crash #58375

Merged
MartinYe1234 merged 1 commit into
mainfrom
anthony/fr-15-zed-8c5-crash-when-mention-offsets-exceed-normalized
Jun 3, 2026
Merged

agent_panel: Fix mention pasting crash #58375
MartinYe1234 merged 1 commit into
mainfrom
anthony/fr-15-zed-8c5-crash-when-mention-offsets-exceed-normalized

Conversation

@Anthony-Eid

Copy link
Copy Markdown
Contributor

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:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content is consistent with the UI/UX checklist
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Release Notes:

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

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
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jun 3, 2026
@zed-community-bot zed-community-bot Bot added the staff Pull requests authored by a current member of Zed staff label Jun 3, 2026
@MartinYe1234 MartinYe1234 added this pull request to the merge queue Jun 3, 2026
Merged via the queue into main with commit 7a8f139 Jun 3, 2026
43 checks passed
@MartinYe1234 MartinYe1234 deleted the anthony/fr-15-zed-8c5-crash-when-mention-offsets-exceed-normalized branch June 3, 2026 03:48
dandv pushed a commit to dandv/zed that referenced this pull request Jun 3, 2026
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
@Anthony-Eid

Copy link
Copy Markdown
Contributor Author

/cherry-pick preview

zed-zippy Bot added a commit that referenced this pull request Jun 3, 2026
…ew) (#58414)

Cherry-pick of #58375 to preview

----
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

Co-authored-by: Anthony Eid <56899983+Anthony-Eid@users.noreply.github.com>
TomPlanche pushed a commit to TomPlanche/zed that referenced this pull request Jun 8, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants