zed/crates/search
Serhii Rubanskyi b01d137ad7
text_finder: Escape the search query in regex mode (#65321)
Pull request [#61335] fixed this issue for the project search, but the
text finder (the "telescope" search) still had the same issue. This
commit copies that behavior by reusing that logic.

#### Summary

When you have the regex mode turned on in the text finder, the selected
query isn't escaped.

This recording shows how it's escaped in the project search, but not in
the telescope search:


https://github.com/user-attachments/assets/02554192-5939-4cef-9d2e-201de332568f

After the fix:


https://github.com/user-attachments/assets/4bc9501a-493d-4b28-9793-166c3a7e230c



#### Testing

To see the issue:
- Open the text finder
- Turn on the regex mode
- Select something with any "special" regex character e.g.`(`
- Call the text finder
=> The query isn't escaped

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:
- Fixed text finder search queries seeded from the current selection
being interpreted as a regular expression instead of literal text when
regex mode was enabled.

[#61335]: https://github.com/zed-industries/zed/pull/61335

---------

Co-authored-by: MrSubidubi <finn@zed.dev>
2026-10-09 07:42:58 +00:00
..
src text_finder: Escape the search query in regex mode (#65321) 2026-10-09 07:42:58 +00:00
Cargo.toml Reduce the dependency footprint (#65176) 2026-10-05 12:44:26 +00:00
LICENSE-GPL