# Fix crash in manipulate_text on multibuffers \(\#57165\) · gitcafe/zed

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

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

Visibility: public

Requested revision: a949cabb327ddab4427ad753b172c6653845711f

Requested commit: a949cabb327ddab4427ad753b172c6653845711f

Commit: a949cabb327ddab4427ad753b172c6653845711f

Tree: f9d3588472512b05048437f1d7a196487a8d2452

Author: Oleksiy Syvokon

Committer: GitHub

## Message

```
Fix crash in manipulate_text on multibuffers (#57165)

In `Editor::manipulate_text`, we computed selection boundaries for the
updated text assuming the requested edit would be applied exactly. This
is not always true. As a result, we could produce an invalid selection
range and panic.

This change replaces manual selection boundary computation with anchors.
It also skips edits when `new_text == old_text`.

Closes FR-10.

Release Notes:

- N/A
```

## Parents

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

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