Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
markdown_preview: Fix release notes title being overridden (#31703)
Simon Pham89c184a26fa4
diff --git a/crates/auto_update_ui/src/auto_update_ui.rs b/crates/auto_update_ui/src/auto_update_ui.rsindex 07c18215887..fa44df75422 100644--- a/crates/auto_update_ui/src/auto_update_ui.rs+++ b/crates/auto_update_ui/src/auto_update_ui.rs@@ -91,7 +91,7 @@ fn view_release_notes_locally(let buffer = cx.new(|cx| MultiBuffer::singleton(buffer, cx));- let tab_content = SharedString::from(body.title.to_string());+ let tab_content = Some(SharedString::from(body.title.to_string()));let editor = cx.new(|cx| {Editor::for_multibuffer(buffer, Some(project), window, cx)});diff --git a/crates/markdown_preview/src/markdown_preview_view.rs b/crates/markdown_preview/src/markdown_preview_view.rsindex a60934283ab..c9c32e216aa 100644--- a/crates/markdown_preview/src/markdown_preview_view.rs+++ b/crates/markdown_preview/src/markdown_preview_view.rs@@ -36,7 +36,7 @@ pub struct MarkdownPreviewView {contents: Option<ParsedMarkdown>,selected_block: usize,list_state: ListState,- tab_content_text: SharedString,+ tab_content_text: Option<SharedString>,language_registry: Arc<LanguageRegistry>,parsing_markdown_task: Option<Task<Result<()>>>,}@@ -130,7 +130,7 @@ impl MarkdownPreviewView {editor,workspace_handle,language_registry,- "Markdown Preview".into(),+ None,window,cx,)@@ -141,7 +141,7 @@ impl MarkdownPreviewView {active_editor: Entity<Editor>,workspace: WeakEntity<Workspace>,language_registry: Arc<LanguageRegistry>,- tab_content_text: SharedString,+ tab_content_text: Option<SharedString>,window: &mut Window,cx: &mut Context<Workspace>,) -> Entity<Self> {@@ -343,7 +343,9 @@ impl MarkdownPreviewView {);let tab_content = editor.read(cx).tab_content_text(0, cx);- self.tab_content_text = format!("Preview {}", tab_content).into();+ if self.tab_content_text.is_none() {+ self.tab_content_text = Some(format!("Preview {}", tab_content).into());+ }self.active_editor = Some(EditorState {editor,@@ -494,7 +496,9 @@ impl Item for MarkdownPreviewView {}fn tab_content_text(&self, _detail: usize, _cx: &App) -> SharedString {- self.tab_content_text.clone()+ self.tab_content_text+ .clone()+ .unwrap_or_else(|| SharedString::from("Markdown Preview"))}fn telemetry_event_text(&self) -> Option<&'static str> {