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.

theme: Properly resolve directory and chevron icons from icon themes (#23984)

Marshall Bowers2c950cf7f5a4
diff --git a/crates/theme/src/registry.rs b/crates/theme/src/registry.rs
index 7b101c2329a..b5e47b23bf4 100644
--- a/crates/theme/src/registry.rs
+++ b/crates/theme/src/registry.rs
@@ -255,6 +255,14 @@ impl ThemeRegistry {
) -> Result<()> {
let icon_theme_family = read_icon_theme(icon_theme_path, fs).await?;
+ let resolve_icon_path = |path: SharedString| {
+ icons_root_dir
+ .join(path.as_ref())
+ .to_string_lossy()
+ .to_string()
+ .into()
+ };
+
let mut state = self.state.write();
for icon_theme in icon_theme_family.themes {
let icon_theme = IconTheme {
@@ -265,23 +273,21 @@ impl ThemeRegistry {
AppearanceContent::Dark => Appearance::Dark,
},
directory_icons: DirectoryIcons {
- collapsed: icon_theme.directory_icons.collapsed,
- expanded: icon_theme.directory_icons.expanded,
+ collapsed: icon_theme.directory_icons.collapsed.map(resolve_icon_path),
+ expanded: icon_theme.directory_icons.expanded.map(resolve_icon_path),
},
chevron_icons: ChevronIcons {
- collapsed: icon_theme.chevron_icons.collapsed,
- expanded: icon_theme.chevron_icons.expanded,
+ collapsed: icon_theme.chevron_icons.collapsed.map(resolve_icon_path),
+ expanded: icon_theme.chevron_icons.expanded.map(resolve_icon_path),
},
file_icons: icon_theme
.file_icons
.into_iter()
.map(|(key, icon)| {
- let path = icons_root_dir.join(icon.path.as_ref());
-
(
key,
IconDefinition {
- path: path.to_string_lossy().to_string().into(),
+ path: resolve_icon_path(icon.path),
},
)
})