# editor: Autoscroll to initial selection on select all matches edit \(\#49232\) · gitcafe/zed

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

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

Visibility: public

Requested revision: a2f1703e288d88b4ac8ab95f4afe6999be59d2c0

Requested commit: a2f1703e288d88b4ac8ab95f4afe6999be59d2c0

Commit: a2f1703e288d88b4ac8ab95f4afe6999be59d2c0

Tree: 113c3923e23b4613e3ca6a19029ab0fd656fa517

Author: Ben Vollrath

Committer: GitHub

## Message

```
editor: Autoscroll to initial selection on select all matches edit (#49232)

Fix the way selections are built in `Editor::select_all_matches` in
order to guarantee that the original selection, where the user's cursor
is located, is the last selection provided to
`MutableSelectionsCollection::select_ranges` as the editor will attempt
to scroll to the last selection when the user starts editing.

This way, we ensure that the user stays in the same location from which
the `editor: select all matches` action was triggered when they start
editing.

Closes #32894

Release Notes:

- Fixed an issue where editing selections after `editor: select all
matches` would scroll to the last match

---------

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

## Parents

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

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