# editor: Inherit whole word match from buffer search \(\#64137\) · gitcafe/zed

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

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

Visibility: public

Requested revision: baee1ca6de0feb9b87d4e5288cf40b02bdf4c370

Requested commit: baee1ca6de0feb9b87d4e5288cf40b02bdf4c370

Commit: baee1ca6de0feb9b87d4e5288cf40b02bdf4c370

Tree: a864e4391bed3cc60b437ebe74bca7705388f1c8

Author: Alessandro Martone

Committer: GitHub

## Message

```
editor: Inherit whole word match from buffer search (#64137)

# Objective

Make `editor: select next` / `editor: select previous` more powerful and
conform to VSCode behaviour
Partial fix for #15415

## Solution

When `editor: select next`/`editor: select previous`/`editor: select
all` is used from an existing selection, it'll now inherit whole-word
from the buffer search bar, while it's open.

If those commands are used starting from a single caret, continue to
always match whole words, with case sensitivity continuing to be
configurable in that case.

## Testing

Test both manually, as well as with unit tests:

- Updated `editor::editor_tests::test_select_next` with new assertion
for whole-word matching
- Added
`search::buffer_search::tests::test_set_active_pane_item_syncs_select_search_options`
- Added
`search::buffer_search::tests::test_search_option_change_during_selections`
- Added
`search::buffer_search::tests::test_show_syncs_select_search_options`

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Improved `editor: select next` and `editor: select previous` to
respect the buffer search whole-word option.

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
```

## Parents

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

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