diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 0696e4b5acd0ab03e3f641fedf178b97fbb469a1..5e1c6ee8cca1292897821a9dd98cb267a5ca28c7 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -552,6 +552,7 @@ pub struct Editor { tasks_update_task: Option>, previous_search_ranges: Option]>>, file_header_size: u8, + breadcrumb_header: Option, } #[derive(Clone)] @@ -1863,6 +1864,7 @@ impl Editor { tasks_update_task: None, linked_edit_ranges: Default::default(), previous_search_ranges: None, + breadcrumb_header: None, }; this.tasks_update_task = Some(this.refresh_runnables(cx)); this._subscriptions.extend(project_subscriptions); @@ -10505,6 +10507,10 @@ impl Editor { ) } + pub fn set_breadcrumb_header(&mut self, new_header: String) { + self.breadcrumb_header = Some(new_header); + } + pub fn clear_search_within_ranges(&mut self, cx: &mut ViewContext) { self.clear_background_highlights::(cx); } diff --git a/crates/editor/src/items.rs b/crates/editor/src/items.rs index b112e779079dd664ef92d703650ad7edcbeac2d8..2dc0b6c6164d533ca18085b34d284d6d7e54e225 100644 --- a/crates/editor/src/items.rs +++ b/crates/editor/src/items.rs @@ -816,22 +816,24 @@ impl Item for Editor { let buffer = multibuffer.buffer(buffer_id)?; let buffer = buffer.read(cx); - let filename = buffer - .snapshot() - .resolve_file_path( - cx, - self.project - .as_ref() - .map(|project| project.read(cx).visible_worktrees(cx).count() > 1) - .unwrap_or_default(), - ) - .map(|path| path.to_string_lossy().to_string()) - .unwrap_or_else(|| "untitled".to_string()); + let text = self.breadcrumb_header.clone().unwrap_or_else(|| { + buffer + .snapshot() + .resolve_file_path( + cx, + self.project + .as_ref() + .map(|project| project.read(cx).visible_worktrees(cx).count() > 1) + .unwrap_or_default(), + ) + .map(|path| path.to_string_lossy().to_string()) + .unwrap_or_else(|| "untitled".to_string()) + }); let settings = ThemeSettings::get_global(cx); let mut breadcrumbs = vec![BreadcrumbText { - text: filename, + text, highlights: None, font: Some(settings.buffer_font.clone()), }]; diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 9407c39bade66cc23fa8f95524b6c7ae70b4ed1d..bf48d30be146d249ffcc615631b500f809ceadf8 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -633,7 +633,14 @@ fn open_log_file(workspace: &mut Workspace, cx: &mut ViewContext) { MultiBuffer::singleton(buffer, cx).with_title("Log".into()) }); let editor = cx.new_view(|cx| { - Editor::for_multibuffer(buffer, Some(project), true, cx) + let mut editor = + Editor::for_multibuffer(buffer, Some(project), true, cx); + editor.set_breadcrumb_header(format!( + "Last {} lines in {}", + MAX_LINES, + paths::log_file().display() + )); + editor }); editor.update(cx, |editor, cx| {