Emit a BreadcrumbsChanged event when associated settings changed (#36177)

Closes https://github.com/zed-industries/zed/issues/36149

Release Notes:

- Fixed a bug where changing the `toolbar.breadcrumbs` setting didn't
immediately update the UI when saving the `settings.json` file.
This commit is contained in:
Joseph T. Lyons 2025-08-14 11:22:38 -04:00
parent 08351cb3e7
commit fda9369bfd
2 changed files with 10 additions and 0 deletions

View file

@ -20200,6 +20200,7 @@ impl Editor {
); );
let old_cursor_shape = self.cursor_shape; let old_cursor_shape = self.cursor_shape;
let old_show_breadcrumbs = self.show_breadcrumbs;
{ {
let editor_settings = EditorSettings::get_global(cx); let editor_settings = EditorSettings::get_global(cx);
@ -20213,6 +20214,10 @@ impl Editor {
cx.emit(EditorEvent::CursorShapeChanged); cx.emit(EditorEvent::CursorShapeChanged);
} }
if old_show_breadcrumbs != self.show_breadcrumbs {
cx.emit(EditorEvent::BreadcrumbsChanged);
}
let project_settings = ProjectSettings::get_global(cx); let project_settings = ProjectSettings::get_global(cx);
self.serialize_dirty_buffers = self.serialize_dirty_buffers =
!self.mode.is_minimap() && project_settings.session.restore_unsaved_buffers; !self.mode.is_minimap() && project_settings.session.restore_unsaved_buffers;
@ -22834,6 +22839,7 @@ pub enum EditorEvent {
}, },
Reloaded, Reloaded,
CursorShapeChanged, CursorShapeChanged,
BreadcrumbsChanged,
PushedToNavHistory { PushedToNavHistory {
anchor: Anchor, anchor: Anchor,
is_deactivate: bool, is_deactivate: bool,

View file

@ -1036,6 +1036,10 @@ impl Item for Editor {
f(ItemEvent::UpdateBreadcrumbs); f(ItemEvent::UpdateBreadcrumbs);
} }
EditorEvent::BreadcrumbsChanged => {
f(ItemEvent::UpdateBreadcrumbs);
}
EditorEvent::DirtyChanged => { EditorEvent::DirtyChanged => {
f(ItemEvent::UpdateTab); f(ItemEvent::UpdateTab);
} }