# editor: Fix inconsistent SelectPrevious behavior \(\#27695\) · gitcafe/zed

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

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

Visibility: public

Requested revision: a07ba3c7183190dd05916f1e92aa84f088e542d0

Requested commit: a07ba3c7183190dd05916f1e92aa84f088e542d0

Commit: a07ba3c7183190dd05916f1e92aa84f088e542d0

Tree: 28acb4253b67fe2d551e1499fb4a95356a208086

Author: Francisco Fernandes

Committer: GitHub

## Message

```
editor: Fix inconsistent SelectPrevious behavior (#27695)

When starting a selection from only carets, the action
`editor::SelectPrevious` behaved in a manner inconsistent with
`editor::SelectNext` as well as equivalent keybinds in editors such as
VSCode, by selecting substrings of whole words matching the initially
selected string on subsequent triggers.

This fix brings the `select_previous` function in line with
`select_next_internal`by calling `select_match_ranges` (previously an
internal function of `select_next_internal`) in the same way it was
previously used in the function that exhibited expected behavior.

Furthermore, the relevant test was adapted to bring it in line with the
equivalent test for the `editor::SelectNext` action

Closes #24346

Release Notes:

- Fixed inconsistent SelectPrevious behavior
```

## Parents

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

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