# editor: Restore selections to positions after last edit \(\#28527\) · gitcafe/zed

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

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

Visibility: public

Requested revision: fbbc23bec3aa1037a4ac3d6269c5804675efde88

Requested commit: fbbc23bec3aa1037a4ac3d6269c5804675efde88

Commit: fbbc23bec3aa1037a4ac3d6269c5804675efde88

Tree: 3f8818e2d7571698ee2c73a7a84d1541997ccf63

Author: Ben Kunkle

Committer: GitHub

## Message

```
editor: Restore selections to positions after last edit (#28527)

Closes #22692

Makes it so when undoing a format operation, the selections are set to
where they were at the last edit.

Release Notes:

- Made it so the cursor position is reset to where it was after the last
edit when undoing a format operation. This will only result in different
behavior when you make an edit, scroll away, initiate formatting (either
by saving or manually) and then undo the format.

---------

Co-authored-by: Zed AI <ai@zed.dev>
```

## Parents

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

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