editor: Respect search case sensitivity when selecting occurrences (#42121)

Update how the editor's `select_*` methods work in order to respect the
`search.case_sensitive` setting, or to be overriden by the
`BufferSearchBar` search options.

- Update both the `SearchableItem` and `SearchableItemHandle` traits
  with a new `set_search_is_case_sensitive` method that allows callers
  to set the case sensitivity of the search
- Update the `BufferSearchBar` to leverage
  `SearchableItemHandle.set_search_is_case_sensitive` in order to sync
  its case sensitivity options with the searchable item
- Update the implementation of the `SearchableItem` trait for `Editor`
  so as to store the argument provided to the
  `set_search_is_case_sensitive` method
- Update the way search queries are built by `Editor` so as to rely on
  `SearchableItem.set_search_is_case_sensitive` argument, if not `None`,
  or default to the editor's `search.case_sensitive` settings

Closes #41070 

Release Notes:

- Improved the "Select Next Occurrence", "Select Previous Occurrence"
and "Select All Occurrences" actions in order to respect the case
sensitivity search settings

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
Dino
2025-11-11 10:26:40 +00:00
committed by GitHub
co-authored by Conrad Irwin
parent dcf56144b5
commit 97100ce52f
9 changed files with 285 additions and 18 deletions
+41 -1
View File
@@ -3184,13 +3184,53 @@ Non-negative `integer` values
```json [settings]
"search": {
"button": true,
"whole_word": false,
"case_sensitive": false,
"include_ignored": false,
"regex": false
"regex": false,
"center_on_match": false
},
```
### Button
- Description: Whether to show the project search button in the status bar.
- Setting: `button`
- Default: `true`
### Whole Word
- Description: Whether to only match on whole words.
- Setting: `whole_word`
- Default: `false`
### Case Sensitive
- Description: Whether to match case sensitively. This setting affects both
searches and editor actions like "Select Next Occurrence", "Select Previous
Occurrence", and "Select All Occurrences".
- Setting: `case_sensitive`
- Default: `false`
### Include Ignore
- Description: Whether to include gitignored files in search results.
- Setting: `include_ignored`
- Default: `false`
### Regex
- Description: Whether to interpret the search query as a regular expression.
- Setting: `regex`
- Default: `false`
### Center On Match
- Description: Whether to center the cursor on each search match when navigating.
- Setting: `center_on_match`
- Default: `false`
## Search Wrap
- Description: If `search_wrap` is disabled, search result do not wrap around the end of the file