# search: Add support for case-sensitivity pattern items \(\#34762\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 0a9f40787216f18ee2f4dc79211877d1af496284

Requested commit: 0a9f40787216f18ee2f4dc79211877d1af496284

Commit: 0a9f40787216f18ee2f4dc79211877d1af496284

Tree: d8370c1eb6bb26e94511a5b87527d354caae93cf

Author: Dino

Committer: GitHub

## Message

```
search: Add support for case-sensitivity pattern items (#34762)

This Pull Request introduces support for pattern items in the buffer
search. It does so by splitting the `query` methods into two new
methods:

- `BufferSearchBar.raw_query` – returns the text from the search query
editor
- `BufferSearchBar.query` - returns the search query with pattern items
removed

Whenever the search query is updated, processing of the
`EditorEvent::Edited` event ends up calling the
`BufferSearchBar.apply_pattern_items` method, which parses the pattern
items from the raw query, and updates the buffer search bar's search
options accordingly. This `apply_pattern_items` function avoids updating
the `BufferSearchBar.default_options` field in order to be able to reset
the search options when a pattern items is removed. Lastly, new pattern
items can easily be added by updating the `PATTERN_ITEMS` array.

### Screen Capture


https://github.com/user-attachments/assets/ebd83c38-e480-4c24-9b8c-6edde69cf392

---

Closes #32390

Release Notes:

- Added support for the `\c` and `\C` query pattern items to control
case-sensitivity in buffer search

---------

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

## Parents

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

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