pane: Turn off preview mode when pinning a tab (#22501)

I opened the tab in preview mode, pinned it, then I opened another file,
but its tab unexpectedly closed.


https://github.com/user-attachments/assets/b857382e-f0ad-4d5a-9036-19de01663c97

Pinning a tab now turns off preview mode.



https://github.com/user-attachments/assets/e34b7c7f-452b-4f36-99c1-e0c68429225c


Release Notes:

- Pinning a preview tab will now turn off preview mode

---------

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
This commit is contained in:
Hayashi Mikihiro 2025-01-02 13:09:35 +09:00 committed by GitHub
parent c11bde7bf4
commit 44af405fb0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1961,6 +1961,10 @@ impl Pane {
self.pinned_tab_count += 1;
let id = self.item_for_index(ix)?.item_id();
if self.is_active_preview_item(id) {
self.set_preview_item_id(None, cx);
}
self.workspace
.update(cx, |_, cx| {
cx.defer(move |_, cx| move_item(&pane, &pane, id, destination_index, cx));