# multi_buffer: Fix handling of \`ExcerptId::max\(\)\` \(\#38887\) · gitcafe/zed

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

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

Visibility: public

Requested revision: fc0b2491365cb547814880b687d5f0bda54f488c

Requested commit: fc0b2491365cb547814880b687d5f0bda54f488c

Commit: fc0b2491365cb547814880b687d5f0bda54f488c

Tree: be8c60d3002119360dfd44cc34d0e74ccd416d91

Author: Lukas Wirth

Committer: GitHub

## Message

```
multi_buffer: Fix handling of `ExcerptId::max()` (#38887)

This removes a hack from `MultiBuffer::anchor_at` that works around
missing logic for handling `ExcerptId::max()` by implementing that said
missing logic.

Generally, `ExcerptId::min()` is already being handled correctly due to
how `Cursor` seeking works, we tend to seek to or beyond a seek target,
meaning `min` will always match the first excerpt as expected. `max` on
the other hand will always seek beyond the last excerpt resulting in no
excerpt being found, so any code path dealing with the excerpt sumtree
will have to specially check for this special excerpt ID to work
correctly.

Release Notes:

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

## Parents

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

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