# multi_buffer: Fix \`editor::ExpandExcerpts\` failing when cursor is at excerpt start \(\#42324\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 0e2041dd41a8c7252b53f1ae8772d3a8f1e7e169

Requested commit: 0e2041dd41a8c7252b53f1ae8772d3a8f1e7e169

Commit: 0e2041dd41a8c7252b53f1ae8772d3a8f1e7e169

Tree: 24c5d84cb36629670d4411459c0254a31f7ce1d0

Author: Ole Jørgen Brønner

Committer: GitHub

## Message

```
multi_buffer: Fix `editor::ExpandExcerpts` failing when cursor is at excerpt start (#42324)

The bug is easily verified by:

1. open any multi-buffer
2. place the cursor at the beginning of an excerpt
3. run the editor::ExpandExcerpts / editor: expand excerpts action
4. The excerpt is not expanded

Since the `buffer_ids_for_range` function basically did the same and had
even been changed the same way earlier I DRYed these functions as well.

Note: I'm a rust novice, so keep an extra eye on rust technicalities
when reviewing :)

---

Release Notes:

- Fix editor: expand excerpts failing when cursor is at excerpt start

---------

Co-authored-by: Lukas Wirth <me@lukaswirth.dev>
```

## Parents

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

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