Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

editor: Fix singleton multibuffer titles not being replicated (#40896)

Lukas Wirthd0398da09955
diff --git a/crates/editor/src/items.rs b/crates/editor/src/items.rs
index 6a5552f8c7a..28a41692567 100644
--- a/crates/editor/src/items.rs
+++ b/crates/editor/src/items.rs
@@ -226,7 +226,7 @@ impl FollowableItem for Editor {
Some(proto::view::Variant::Editor(proto::view::Editor {
singleton: buffer.is_singleton(),
- title: (!buffer.is_singleton()).then(|| buffer.title(cx).into()),
+ title: buffer.explicit_title().map(ToOwned::to_owned),
excerpts,
scroll_top_anchor: Some(serialize_anchor(&scroll_anchor.anchor, &snapshot)),
scroll_x: scroll_anchor.offset.x,
diff --git a/crates/multi_buffer/src/multi_buffer.rs b/crates/multi_buffer/src/multi_buffer.rs
index e9e3b6f62c2..e6e2f7f1c68 100644
--- a/crates/multi_buffer/src/multi_buffer.rs
+++ b/crates/multi_buffer/src/multi_buffer.rs
@@ -2556,6 +2556,10 @@ impl MultiBuffer {
self.buffers.values().for_each(|state| f(&state.buffer))
}
+ pub fn explicit_title(&self) -> Option<&str> {
+ self.title.as_deref()
+ }
+
pub fn title<'a>(&'a self, cx: &'a App) -> Cow<'a, str> {
if let Some(title) = self.title.as_ref() {
return title.into();