Skip to content

Fix panic in breadcrumbs#49930

Merged
ConradIrwin merged 1 commit intomainfrom
fix-breadcrumb-panic
Feb 23, 2026
Merged

Fix panic in breadcrumbs#49930
ConradIrwin merged 1 commit intomainfrom
fix-breadcrumb-panic

Conversation

@ConradIrwin
Copy link
Member

@ConradIrwin ConradIrwin commented Feb 23, 2026

The hypothesis is that some language's tree-sitter queries can return tokens containing newlines; though we weren't able to reproduce easily in a test.

Before you mark this PR as ready for review, make sure that you have:

  • Added a solid test coverage and/or screenshots from doing manual testing
  • Done a self-review taking into account security and performance aspects
  • Aligned any UI changes with the UI checklist

Fixes https://zed-dev.sentry.io/issues/7286512714/?project=4509715135987712&query=is%3Aunresolved&referrer=issue-stream

Release Notes:

  • Fix (rare) panic when breadcrumbs contain newlines (hopefully)

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 23, 2026
@zed-community-bot zed-community-bot bot added the staff Pull requests authored by a current member of Zed staff label Feb 23, 2026
@ConradIrwin ConradIrwin enabled auto-merge (squash) February 23, 2026 22:30
@ConradIrwin ConradIrwin merged commit 778f2d3 into main Feb 23, 2026
39 checks passed
@ConradIrwin ConradIrwin deleted the fix-breadcrumb-panic branch February 23, 2026 22:32
@ConradIrwin
Copy link
Member Author

/cherry-pick preview

github-actions bot pushed a commit that referenced this pull request Feb 25, 2026
Closes #ISSUE

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)


Fixes
https://zed-dev.sentry.io/issues/7286512714/?project=4509715135987712&query=is%3Aunresolved&referrer=issue-stream

Release Notes:

- Fix (rare) panic when breadcrumbs contain newlines
zed-zippy bot added a commit that referenced this pull request Feb 25, 2026
Cherry-pick of #49930 to preview

----
Closes #ISSUE

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI

checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)


Fixes

https://zed-dev.sentry.io/issues/7286512714/?project=4509715135987712&query=is%3Aunresolved&referrer=issue-stream

Release Notes:

- Fix (rare) panic when breadcrumbs contain newlines

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
}

StyledText::new(segment.text.replace('\n', ""))
StyledText::new(segment.text.replace('\n', " "))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isnt the cause for the panic here the fact that we switch out a 1 byte character with a 3 byte character, causing the highlights if they exist to be incorrect as their offsets are now wrong?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, so using a single byte character instead fixes it.

It seems like newlines in breadcrumbs are rare, so it didn’t seem worth rebasing the highlights to keep the fancy newline

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yea makes sense

Anthony-Eid pushed a commit to bobbymannino/zed that referenced this pull request Feb 25, 2026
Closes #ISSUE

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)


Fixes
https://zed-dev.sentry.io/issues/7286512714/?project=4509715135987712&query=is%3Aunresolved&referrer=issue-stream

Release Notes:

- Fix (rare) panic when breadcrumbs contain newlines
tahayvr pushed a commit to tahayvr/zed that referenced this pull request Mar 4, 2026
Closes #ISSUE

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)


Fixes
https://zed-dev.sentry.io/issues/7286512714/?project=4509715135987712&query=is%3Aunresolved&referrer=issue-stream

Release Notes:

- Fix (rare) panic when breadcrumbs contain newlines
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