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.

auto_update_ui: Set a title when viewing release notes locally (#49153)

Nicolas Le Cam180d32023dbd
diff --git a/crates/auto_update_ui/src/auto_update_ui.rs b/crates/auto_update_ui/src/auto_update_ui.rs
index bb300efac10..6d3f90a2d5e 100644
--- a/crates/auto_update_ui/src/auto_update_ui.rs
+++ b/crates/auto_update_ui/src/auto_update_ui.rs
@@ -31,10 +31,6 @@ pub fn init(cx: &mut App) {
#[derive(Deserialize)]
struct ReleaseNotesBody {
- #[expect(
- unused,
- reason = "This field was found to be unused with serde library bump; it's left as is due to insufficient context on PO's side, but it *may* be fine to remove"
- )]
title: String,
release_notes: String,
}
@@ -123,7 +119,7 @@ fn view_release_notes_locally(
buffer.edit([(0..0, body.release_notes)], None, cx)
});
- let buffer = cx.new(|cx| MultiBuffer::singleton(buffer, cx));
+ let buffer = cx.new(|cx| MultiBuffer::singleton(buffer, cx).with_title(body.title));
let ws_handle = workspace.clone();
workspace
diff --git a/crates/markdown_preview/src/markdown_preview_view.rs b/crates/markdown_preview/src/markdown_preview_view.rs
index b3e6f2a9be7..9e504a0e660 100644
--- a/crates/markdown_preview/src/markdown_preview_view.rs
+++ b/crates/markdown_preview/src/markdown_preview_view.rs
@@ -525,15 +525,10 @@ impl Item for MarkdownPreviewView {
fn tab_content_text(&self, _detail: usize, cx: &App) -> SharedString {
self.active_editor
.as_ref()
- .and_then(|editor_state| {
+ .map(|editor_state| {
let buffer = editor_state.editor.read(cx).buffer().read(cx);
- let buffer = buffer.as_singleton()?;
- let file = buffer.read(cx).file()?;
- let local_file = file.as_local()?;
- local_file
- .abs_path(cx)
- .file_name()
- .map(|name| format!("Preview {}", name.to_string_lossy()).into())
+ let title = buffer.title(cx);
+ format!("Preview {}", title).into()
})
.unwrap_or_else(|| SharedString::from("Markdown Preview"))
}