Simplify setting font size for EditToolCard (#29925)

Release Notes:

- N/A
This commit is contained in:
Antonio Scandurra 2025-05-05 17:04:00 +02:00 committed by GitHub
parent 0246ec2dab
commit b0414df921
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,7 +8,7 @@ use buffer_diff::{BufferDiff, BufferDiffSnapshot};
use editor::{Editor, EditorElement, EditorMode, EditorStyle, MultiBuffer, PathKey};
use gpui::{
Animation, AnimationExt, AnyWindowHandle, App, AppContext, AsyncApp, Context, Entity, EntityId,
Task, TextStyle, TextStyleRefinement, WeakEntity, pulsating_between,
Task, TextStyle, WeakEntity, pulsating_between,
};
use language::{
Anchor, Buffer, Capability, LanguageRegistry, LineEnding, OffsetRangeExt, Rope, TextBuffer,
@ -541,12 +541,6 @@ impl ToolCard for EditFileToolCard {
let (editor, editor_line_height) = self.editor.update(cx, |editor, cx| {
let ui_font_size = ThemeSettings::get_global(cx).ui_font_size(cx);
editor.set_text_style_refinement(TextStyleRefinement {
font_size: Some(ui_font_size.into()),
..TextStyleRefinement::default()
});
let line_height = editor
.style()
.map(|style| style.text.line_height_in_pixels(window.rem_size()))
@ -564,7 +558,7 @@ impl ToolCard for EditFileToolCard {
font_family: settings.buffer_font.family.clone(),
font_features: settings.buffer_font.features.clone(),
font_fallbacks: settings.buffer_font.fallbacks.clone(),
font_size: settings.buffer_font_size(cx).into(),
font_size: ui_font_size.into(),
font_weight: settings.buffer_font.weight,
line_height: relative(settings.buffer_line_height.value()),
..Default::default()