# editor: Preserve preview tabs for references multibuffers \(\#61021\) · gitcafe/zed

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

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

Visibility: public

Requested revision: b0f145f4aec671970340a528cb8197181e969e8c

Requested commit: b0f145f4aec671970340a528cb8197181e969e8c

Commit: b0f145f4aec671970340a528cb8197181e969e8c

Tree: 37468ef25bd20f8fbe6a10596d4f8a87c221381b

Author: Shuhei Kadowaki

Committer: GitHub

## Message

```
editor: Preserve preview tabs for references multibuffers (#61021)

When `preview_tabs.enabled` and
`preview_tabs.enable_preview_multibuffer_from_code_navigation` are
enabled, Find All References opens its multibuffer as a preview tab.

A references multibuffer is assembled from existing buffers, which may
already contain edits when the preview is created. When creating the
multibuffer to display the references, it ends up emitting edit events
as excerpts are added, this will later cause `Pane::handle_item_edit` to
run, which would see these buffer edits since `Buffer::preview_version`
and unpreview the tab, as the `Buffer::preview_version` value was not
being updated after edits.

Refresh the multibuffer’s preview baseline before opening a newly
created code-navigation multibuffer as a preview. Background diff
updates then preserve the preview, while subsequent user edits still
make it permanent. This leaves the existing editor event and search
invalidation behavior unchanged.

Release Notes:

- Fixed `editor: find all references` preview tabs becoming permanent
tabs if any of the buffers had been edited before

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
```

## Parents

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

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