mirror of
https://github.com/zed-industries/zed.git
synced 2026-05-30 20:24:08 +00:00
It's possible to create a multibuffer anchor that points into a specific excerpted buffer (so not min/max), but whose main buffer `text::Anchor` isn't contained in any of the excerpts for that buffer. When summarizing such an anchor, we map it to the multibuffer position of the start of the next excerpt after where the anchor "should" appear. Or at least, that's the intention, but it turned out we had some bugs in `summary_for_anchor` and `summaries_for_anchors` that caused them to return bizarre summaries for these anchors. This PR fixes that and also updates `test_random_multibuffer` to actually test `MultiBufferSnapshot::summary_for_anchor` against a reference implementation, including for out-of-bounds anchors. Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - N/A --------- Co-authored-by: Anthony <anthony@zed.dev> Co-authored-by: Max <max@zed.dev> Co-authored-by: Anthony Eid <hello@anthonyeid.me> |
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||
| LICENSE-GPL | ||