# multi_buffer: Make \`anchor_in_excerpt\` fallible for bad text anchors \(\#40496\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 83bfe2ff7ba9b711bb80f80a4aad15f585ff964f

Requested commit: 83bfe2ff7ba9b711bb80f80a4aad15f585ff964f

Commit: 83bfe2ff7ba9b711bb80f80a4aad15f585ff964f

Tree: e81f1ba64d40e01d76c4b818adee1bc0c29e944b

Author: Lukas Wirth

Committer: GitHub

## Message

```
multi_buffer: Make `anchor_in_excerpt` fallible for bad text anchors (#40496)

`MultiBuffer::anchor_in_excerpt` currently just wraps the given text
anchor in a multibuffer anchor. This allows one to get a multibuffer
anchor that points outside its excerpt which is basically never what one
wants. This PR now does a bounds check and returns `None` if the given
text anchor is not within the bounds of the excerpt.

Release Notes:

- N/A *or* Added/Fixed/Improved ...

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
```

## Parents

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

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