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.

inline blame: Match icon size to font size in buffer (#11788)

Thorsten Ballec65035659fe
diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs
index 5c8492b58fa..eb9f717bc2b 100644
--- a/crates/editor/src/element.rs
+++ b/crates/editor/src/element.rs
@@ -3388,7 +3388,11 @@ fn render_inline_blame_entry(
.font_family(style.text.font().family)
.text_color(cx.theme().status().hint)
.line_height(style.text.line_height)
- .child(Icon::new(IconName::FileGit).color(Color::Hint))
+ .child(
+ Icon::new(IconName::FileGit)
+ .color(Color::Hint)
+ .font_size(style.text.font_size),
+ )
.child(text)
.gap_2()
.hoverable_tooltip(move |_| tooltip.clone().into())
diff --git a/crates/ui/src/components/icon.rs b/crates/ui/src/components/icon.rs
index d94b573cbe8..2215d3dd758 100644
--- a/crates/ui/src/components/icon.rs
+++ b/crates/ui/src/components/icon.rs
@@ -344,6 +344,14 @@ impl Icon {
self
}
+ pub fn font_size(self, font_size: AbsoluteLength) -> Self {
+ let rems = match font_size {
+ AbsoluteLength::Pixels(pixels) => rems_from_px(pixels.into()),
+ AbsoluteLength::Rems(rems) => rems,
+ };
+ self.custom_size(rems)
+ }
+
pub fn transform(mut self, transformation: Transformation) -> Self {
self.transformation = transformation;
self