Fix crash on non-ASCII thread titles in archive search#53114
Merged
Conversation
The archive view's fuzzy_match_positions used chars().enumerate() which produces character indices, not byte indices. When thread titles contain multi-byte UTF-8 characters (emoji, CJK, etc.), these character indices don't correspond to valid byte boundaries, causing a panic in HighlightedLabel::new which asserts that highlight indices are valid UTF-8 boundaries. Switch to char_indices() and eq_ignore_ascii_case() to produce correct byte positions, matching the approach used by the sidebar's version of the same function.
Member
|
@zed-zippy approved |
piper-of-dawn
pushed a commit
to piper-of-dawn/zed
that referenced
this pull request
Apr 25, 2026
…s#53114) The archive view's `fuzzy_match_positions` used `chars().enumerate()` which produces **character indices**, not **byte indices**. When thread titles contain multi-byte UTF-8 characters (emoji, CJK, accented characters, etc.), these character indices don't correspond to valid byte boundaries, causing a panic in `HighlightedLabel::new` which asserts that highlight indices are valid UTF-8 boundaries. The fix switches to `char_indices()` and `eq_ignore_ascii_case()` to produce correct byte positions, matching the approach already used by the sidebar's version of the same function. Release Notes: - Fixed a crash when searching archived threads whose titles contain emoji or other non-ASCII characters.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The archive view's
fuzzy_match_positionsusedchars().enumerate()which produces character indices, not byte indices. When thread titles contain multi-byte UTF-8 characters (emoji, CJK, accented characters, etc.), these character indices don't correspond to valid byte boundaries, causing a panic inHighlightedLabel::newwhich asserts that highlight indices are valid UTF-8 boundaries.The fix switches to
char_indices()andeq_ignore_ascii_case()to produce correct byte positions, matching the approach already used by the sidebar's version of the same function.Release Notes: